-
Notifications
You must be signed in to change notification settings - Fork 523
add join compatibility based on physical_location to destination configurations
#3905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: devel
Are you sure you want to change the base?
Changes from all commits
82927d0
7a5f3dc
afa3768
179d819
8c2736f
5300cbd
f0fc271
4d2fcdd
be64605
2a6cbf6
9750ca5
e25aeb1
fb07471
0b10ab2
f30acc9
a732ce9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,17 @@ | ||
| import dataclasses | ||
| from typing import ClassVar, List, Final, Optional, Union | ||
| from typing import ClassVar, List, Optional, Union | ||
|
|
||
| from dlt.common.configuration import configspec | ||
| from dlt.common.configuration.specs import GcpServiceAccountCredentials, GcpOAuthCredentials | ||
| from dlt.common.utils import digest128 | ||
|
|
||
| from dlt.common.destination.client import DestinationClientDwhWithStagingConfiguration | ||
| from dlt.common.utils import digest128 | ||
|
|
||
|
|
||
| @configspec | ||
| class BigQueryClientConfiguration(DestinationClientDwhWithStagingConfiguration): | ||
| destination_type: Final[str] = dataclasses.field(default="bigquery", init=False, repr=False, compare=False) # type: ignore | ||
| destination_type: str = dataclasses.field( | ||
| default="bigquery", init=False, repr=False, compare=False | ||
| ) | ||
| credentials: Union[GcpServiceAccountCredentials, GcpOAuthCredentials] = None | ||
| location: str = "US" | ||
| project_id: Optional[str] = None | ||
|
|
@@ -39,7 +40,14 @@ def get_location(self) -> str: | |
| return self.location | ||
|
|
||
| def fingerprint(self) -> str: | ||
| """Returns a fingerprint of project_id""" | ||
| """Returns a fingerprint of the credentials project id.""" | ||
| if self.credentials and self.credentials.project_id: | ||
| return digest128(self.credentials.project_id) | ||
| return "" | ||
|
|
||
| def physical_location(self) -> str: | ||
| """Returns configured project id, falling back to credentials.""" | ||
| project_id = self.project_id | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I checked again and bigquery can join based on location. so here just return so now it looks like |
||
| if not project_id and self.credentials: | ||
| project_id = self.credentials.project_id | ||
| return project_id or "" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ | |
|
|
||
| import dataclasses | ||
| from copy import deepcopy | ||
| from typing import TYPE_CHECKING, Any, Callable, ClassVar, Dict, Final, List, Optional, Union, cast | ||
| from typing import TYPE_CHECKING, Any, Callable, ClassVar, Dict, List, Optional, Union, cast | ||
| from urllib.parse import urlparse | ||
|
|
||
| from dlt.common import logger | ||
|
|
@@ -20,7 +20,6 @@ | |
| if TYPE_CHECKING: | ||
| from zerobus import ArrowStreamConfigurationOptions, IPCCompression | ||
|
|
||
|
|
||
| DATABRICKS_APPLICATION_ID = "dltHub_dlt" | ||
| DEFAULT_DATABRICKS_INSERT_API: TDatabricksInsertApi = "copy_into" | ||
| # ZSTD was fastest in my benchmarks out of the three `ipc_compression` options | ||
|
|
@@ -237,7 +236,9 @@ def _coerce_ipc_compression(ipc_compression: Union[str, IPCCompression]) -> IPCC | |
|
|
||
| @configspec | ||
| class DatabricksClientConfiguration(DestinationClientDwhWithStagingConfiguration): | ||
| destination_type: Final[str] = dataclasses.field(default="databricks", init=False, repr=False, compare=False) # type: ignore[misc] | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this "Final" makes sense even with mypy complaining. you removed it in several other places. |
||
| destination_type: str = dataclasses.field( | ||
| default="databricks", init=False, repr=False, compare=False | ||
| ) | ||
| credentials: DatabricksCredentials = None | ||
| staging_credentials_name: Optional[str] = None | ||
| "If set, credentials with given name will be used in copy command" | ||
|
|
@@ -287,7 +288,13 @@ def on_resolved(self) -> None: | |
| ) | ||
|
|
||
| def fingerprint(self) -> str: | ||
| """Returns a fingerprint of host part of a connection string""" | ||
| """Returns a fingerprint of the server hostname.""" | ||
| if self.credentials and self.credentials.server_hostname: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this could reuse physical_location |
||
| return digest128(self.credentials.server_hostname) | ||
| return "" | ||
|
|
||
| def physical_location(self) -> str: | ||
| """Returns the server hostname.""" | ||
| if self.credentials and self.credentials.server_hostname: | ||
| return self.credentials.server_hostname | ||
| return "" | ||
Uh oh!
There was an error while loading. Please reload this page.