Support multi-catalog#105
Merged
Merged
Conversation
Contributor
Author
|
This is based on #94. |
| current_catalog: Optional[str] = None | ||
| try: | ||
| if catalog is not None: | ||
| current_catalog = self.execute_macro(CURRENT_CATALOG_MACRO_NAME)[0][0] |
Collaborator
There was a problem hiding this comment.
Just curious is the result of current_catalog cached somewhere?
Contributor
Author
There was a problem hiding this comment.
No, it's not cached.
Collaborator
allisonwang-db
left a comment
There was a problem hiding this comment.
Looks good! Added a few comments.
| yield as_dict | ||
|
|
||
| @contextmanager | ||
| def _catalog(self, catalog: Optional[str]) -> Iterator[None]: |
Collaborator
There was a problem hiding this comment.
nit: maybe we can add a comment here?
|
|
||
|
|
||
| class TestMultiCatalogTableModels(TestMultiCatalog): | ||
| @use_profile("databricks_uc_cluster") |
Collaborator
There was a problem hiding this comment.
How would the test behave if we run it against a non-uc cluster?
Contributor
Author
There was a problem hiding this comment.
It will just be skipped.
Co-authored-by: allisonwang-db <allison.wang@databricks.com>
Contributor
Author
|
Thanks! merging. |
ueshin
added a commit
to ueshin/dbt-databricks
that referenced
this pull request
Jun 14, 2022
resolves databricks#95 ### Description Supports multi-catalog. Enables `catalog` or `database` config to use a different catalog for models. - model `alternative_catalog` ```sql {{ config( catalog = 'alternative', materialized = 'table' ) }} select * from {{ ref('seed') }} ``` Also enables to run cross catalog queries. ```sql select * from {{ ref('seed') }} union all select * from {{ ref('alternative_catalog')}} ``` Note: mixing Unity Catalog and Hive metastore tables is not recommened: > org.apache.spark.sql.AnalysisException: Non-Unity-Catalog object `hive_metastore`.`schema_1`.`table_a` can't be referenced in Unity Catalog objects > org.apache.spark.sql.AnalysisException: Create a persistent view that references both unity catalog and Hive metastore objects is not supported in Unity Catalog Co-authored-by: allisonwang-db <allison.wang@databricks.com>
ueshin
added a commit
that referenced
this pull request
Jun 15, 2022
resolves #95 ### Description Supports multi-catalog. Enables `catalog` or `database` config to use a different catalog for models. - model `alternative_catalog` ```sql {{ config( catalog = 'alternative', materialized = 'table' ) }} select * from {{ ref('seed') }} ``` Also enables to run cross catalog queries. ```sql select * from {{ ref('seed') }} union all select * from {{ ref('alternative_catalog')}} ``` Note: mixing Unity Catalog and Hive metastore tables is not recommened: > org.apache.spark.sql.AnalysisException: Non-Unity-Catalog object `hive_metastore`.`schema_1`.`table_a` can't be referenced in Unity Catalog objects > org.apache.spark.sql.AnalysisException: Create a persistent view that references both unity catalog and Hive metastore objects is not supported in Unity Catalog Co-authored-by: allisonwang-db <allison.wang@databricks.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
resolves #95
Description
Supports multi-catalog.
Enables
catalogordatabaseconfig to use a different catalog for models.alternative_catalog{{ config( catalog = 'alternative', materialized = 'table' ) }} select * from {{ ref('seed') }}Also enables to run cross catalog queries.
Note: mixing Unity Catalog and Hive metastore tables is not recommened: