Skip to content
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

Enable quotes by default #241

Merged
merged 5 commits into from
Jan 5, 2023
Merged

Conversation

andrefurlan-db
Copy link
Collaborator

@andrefurlan-db andrefurlan-db commented Dec 23, 2022

Description

When working with the Unity Catalog, it is very convenient to quote catalog, schema, or identifiers so generated catalog and schema names work without extra configuration.

resolves #240

Checklist

  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • I have updated the CHANGELOG.md and added information about my change to the "dbt-databricks next" section.

Signed-off-by: Andre Furlan <andre.furlan@databricks.com>
@ueshin
Copy link
Collaborator

ueshin commented Dec 29, 2022

Shall we reuse test_relation.py for the unit test.

e.g.,

diff --git a/tests/unit/test_relation.py b/tests/unit/test_relation.py
index 7db1cc5..e5ce504 100644
--- a/tests/unit/test_relation.py
+++ b/tests/unit/test_relation.py
@@ -8,7 +8,6 @@ from dbt.adapters.databricks.relation import DatabricksRelation
 class TestDatabricksRelation(unittest.TestCase):
     def test_pre_deserialize(self):
         data = {
-            "quote_policy": {"database": False, "schema": False, "identifier": False},
             "path": {
                 "database": "some_database",
                 "schema": "some_schema",
@@ -21,6 +20,7 @@ class TestDatabricksRelation(unittest.TestCase):
         self.assertEqual(relation.database, "some_database")
         self.assertEqual(relation.schema, "some_schema")
         self.assertEqual(relation.identifier, "some_table")
+        self.assertEqual(relation.render(), "`some_database`.`some_schema`.`some_table`")

         data = {
             "quote_policy": {"database": False, "schema": False, "identifier": False},

and same for the following tests.

@andrefurlan-db andrefurlan-db requested a review from ueshin January 4, 2023 23:51
tests/unit/test_macros.py Outdated Show resolved Hide resolved
Signed-off-by: Andre Furlan <andre.furlan@databricks.com>
Signed-off-by: Andre Furlan <andre.furlan@databricks.com>
@andrefurlan-db andrefurlan-db marked this pull request as ready for review January 5, 2023 22:15
@andrefurlan-db andrefurlan-db merged commit 69901db into databricks:main Jan 5, 2023
@andrefurlan-db andrefurlan-db deleted the quotes branch January 5, 2023 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Quote identifiers by default
2 participants