diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-11-25 07:23:18 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-11-25 07:23:18 +0000 |
commit | 9c5cf7fc4a20988d0eda33e4a3afdf7168c05104 (patch) | |
tree | 85160e0a3a39feede46b7546566279525b3af373 /tests/dialects/test_duckdb.py | |
parent | Releasing debian version 25.31.4-1. (diff) | |
download | sqlglot-9c5cf7fc4a20988d0eda33e4a3afdf7168c05104.tar.xz sqlglot-9c5cf7fc4a20988d0eda33e4a3afdf7168c05104.zip |
Merging upstream version 25.32.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/dialects/test_duckdb.py')
-rw-r--r-- | tests/dialects/test_duckdb.py | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/tests/dialects/test_duckdb.py b/tests/dialects/test_duckdb.py index 6007e99..13caf1b 100644 --- a/tests/dialects/test_duckdb.py +++ b/tests/dialects/test_duckdb.py @@ -380,10 +380,6 @@ class TestDuckDB(Validator): "x ->> '$.family'", ) self.validate_identity( - "ATTACH DATABASE ':memory:' AS new_database", check_command_warning=True - ) - self.validate_identity("DETACH DATABASE new_database", check_command_warning=True) - self.validate_identity( "SELECT {'yes': 'duck', 'maybe': 'goose', 'huh': NULL, 'no': 'heron'}" ) self.validate_identity( @@ -1392,3 +1388,20 @@ class TestDuckDB(Validator): else: self.assertEqual(ignore_null.sql("duckdb"), func.sql("duckdb")) self.assertNotIn("IGNORE NULLS", windowed_ignore_null.sql("duckdb")) + + def test_attach_detach(self): + # ATTACH + self.validate_identity("ATTACH 'file.db'") + self.validate_identity("ATTACH ':memory:' AS db_alias") + self.validate_identity("ATTACH IF NOT EXISTS 'file.db' AS db_alias") + self.validate_identity("ATTACH 'file.db' AS db_alias (READ_ONLY)") + self.validate_identity("ATTACH 'file.db' (READ_ONLY FALSE, TYPE sqlite)") + self.validate_identity("ATTACH 'file.db' (TYPE POSTGRES, SCHEMA 'public')") + + self.validate_identity("ATTACH DATABASE 'file.db'", "ATTACH 'file.db'") + + # DETACH + self.validate_identity("DETACH new_database") + self.validate_identity("DETACH IF EXISTS file") + + self.validate_identity("DETACH DATABASE db", "DETACH db") |