datus-postgresql 0.1.6__tar.gz → 0.1.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {datus_postgresql-0.1.6 → datus_postgresql-0.1.7}/PKG-INFO +2 -2
- {datus_postgresql-0.1.6 → datus_postgresql-0.1.7}/datus_postgresql/connector.py +27 -3
- {datus_postgresql-0.1.6 → datus_postgresql-0.1.7}/pyproject.toml +2 -2
- {datus_postgresql-0.1.6 → datus_postgresql-0.1.7}/tests/integration/test_tpch.py +12 -8
- {datus_postgresql-0.1.6 → datus_postgresql-0.1.7}/.gitignore +0 -0
- {datus_postgresql-0.1.6 → datus_postgresql-0.1.7}/README.md +0 -0
- {datus_postgresql-0.1.6 → datus_postgresql-0.1.7}/datus_postgresql/__init__.py +0 -0
- {datus_postgresql-0.1.6 → datus_postgresql-0.1.7}/datus_postgresql/config.py +0 -0
- {datus_postgresql-0.1.6 → datus_postgresql-0.1.7}/datus_postgresql/handlers.py +0 -0
- {datus_postgresql-0.1.6 → datus_postgresql-0.1.7}/docker-compose.yml +0 -0
- {datus_postgresql-0.1.6 → datus_postgresql-0.1.7}/scripts/init_tpch_data.py +0 -0
- {datus_postgresql-0.1.6 → datus_postgresql-0.1.7}/tests/__init__.py +0 -0
- {datus_postgresql-0.1.6 → datus_postgresql-0.1.7}/tests/conftest.py +0 -0
- {datus_postgresql-0.1.6 → datus_postgresql-0.1.7}/tests/integration/__init__.py +0 -0
- {datus_postgresql-0.1.6 → datus_postgresql-0.1.7}/tests/integration/conftest.py +0 -0
- {datus_postgresql-0.1.6 → datus_postgresql-0.1.7}/tests/integration/test_contract.py +0 -0
- {datus_postgresql-0.1.6 → datus_postgresql-0.1.7}/tests/integration/test_integration.py +0 -0
- {datus_postgresql-0.1.6 → datus_postgresql-0.1.7}/tests/unit/__init__.py +0 -0
- {datus_postgresql-0.1.6 → datus_postgresql-0.1.7}/tests/unit/test_config.py +0 -0
- {datus_postgresql-0.1.6 → datus_postgresql-0.1.7}/tests/unit/test_connector_unit.py +0 -0
- {datus_postgresql-0.1.6 → datus_postgresql-0.1.7}/tests/unit/test_migration_mixin.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: datus-postgresql
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.7
|
|
4
4
|
Summary: PostgreSQL database adapter for Datus
|
|
5
5
|
Project-URL: Homepage, https://github.com/Datus-ai/datus-db-adapters
|
|
6
6
|
Project-URL: Repository, https://github.com/Datus-ai/datus-db-adapters
|
|
@@ -15,7 +15,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.12
|
|
16
16
|
Requires-Python: >=3.12
|
|
17
17
|
Requires-Dist: datus-db-core>=0.1.4
|
|
18
|
-
Requires-Dist: datus-sqlalchemy>=0.1.
|
|
18
|
+
Requires-Dist: datus-sqlalchemy>=0.1.7
|
|
19
19
|
Requires-Dist: psycopg2-binary>=2.9.11
|
|
20
20
|
Requires-Dist: pydantic>=2.0.0
|
|
21
21
|
Description-Content-Type: text/markdown
|
|
@@ -337,21 +337,45 @@ class PostgreSQLConnector(SQLAlchemyConnector, MigrationTargetMixin):
|
|
|
337
337
|
return result
|
|
338
338
|
|
|
339
339
|
@override
|
|
340
|
+
@staticmethod
|
|
341
|
+
def _qualify_name(meta, arg_db, arg_schema):
|
|
342
|
+
"""Prefix the table with the db/schema levels the caller left blank.
|
|
343
|
+
|
|
344
|
+
Yields ``[db.][schema.]table`` so an unscoped listing stays addressable; a level is
|
|
345
|
+
prepended only when the caller passed it empty and the row carries that coordinate.
|
|
346
|
+
"""
|
|
347
|
+
parts = []
|
|
348
|
+
if not arg_db and meta.get("database_name"):
|
|
349
|
+
parts.append(meta["database_name"])
|
|
350
|
+
if not arg_schema and meta.get("schema_name"):
|
|
351
|
+
parts.append(meta["schema_name"])
|
|
352
|
+
parts.append(meta["table_name"])
|
|
353
|
+
return ".".join(parts)
|
|
354
|
+
|
|
340
355
|
def get_tables(self, catalog_name: str = "", database_name: str = "", schema_name: str = "") -> List[str]:
|
|
341
356
|
"""Get list of table names."""
|
|
342
|
-
return [
|
|
357
|
+
return [
|
|
358
|
+
self._qualify_name(meta, database_name, schema_name)
|
|
359
|
+
for meta in self._get_metadata("table", catalog_name, database_name, schema_name)
|
|
360
|
+
]
|
|
343
361
|
|
|
344
362
|
@override
|
|
345
363
|
def get_views(self, catalog_name: str = "", database_name: str = "", schema_name: str = "") -> List[str]:
|
|
346
364
|
"""Get list of view names."""
|
|
347
|
-
return [
|
|
365
|
+
return [
|
|
366
|
+
self._qualify_name(meta, database_name, schema_name)
|
|
367
|
+
for meta in self._get_metadata("view", catalog_name, database_name, schema_name)
|
|
368
|
+
]
|
|
348
369
|
|
|
349
370
|
@override
|
|
350
371
|
def get_materialized_views(
|
|
351
372
|
self, catalog_name: str = "", database_name: str = "", schema_name: str = ""
|
|
352
373
|
) -> List[str]:
|
|
353
374
|
"""Get list of materialized view names."""
|
|
354
|
-
return [
|
|
375
|
+
return [
|
|
376
|
+
self._qualify_name(meta, database_name, schema_name)
|
|
377
|
+
for meta in self._get_metadata("mv", catalog_name, database_name, schema_name)
|
|
378
|
+
]
|
|
355
379
|
|
|
356
380
|
@override
|
|
357
381
|
def get_tables_with_ddl(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "datus-postgresql"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.7"
|
|
4
4
|
description = "PostgreSQL database adapter for Datus"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.12"
|
|
@@ -19,7 +19,7 @@ classifiers = [
|
|
|
19
19
|
|
|
20
20
|
dependencies = [
|
|
21
21
|
"datus-db-core>=0.1.4",
|
|
22
|
-
"datus-sqlalchemy>=0.1.
|
|
22
|
+
"datus-sqlalchemy>=0.1.7",
|
|
23
23
|
"psycopg2-binary>=2.9.11",
|
|
24
24
|
"pydantic>=2.0.0",
|
|
25
25
|
]
|
|
@@ -128,17 +128,21 @@ class TestTpchMetadata:
|
|
|
128
128
|
"""Validate metadata retrieval for TPC-H tables."""
|
|
129
129
|
|
|
130
130
|
def test_get_tables_includes_tpch(self, tpch_setup):
|
|
131
|
-
"""get_tables() should return TPC-H tables.
|
|
131
|
+
"""get_tables() should return TPC-H tables qualified with the database name.
|
|
132
|
+
|
|
133
|
+
Only ``schema_name`` is passed, so the listing prefixes the unscoped database
|
|
134
|
+
level, yielding ``<database>.<table>``.
|
|
135
|
+
"""
|
|
132
136
|
tables = tpch_setup.get_tables(schema_name="public")
|
|
133
|
-
|
|
137
|
+
db = tpch_setup.database_name
|
|
134
138
|
expected = {
|
|
135
|
-
"tpch_region",
|
|
136
|
-
"tpch_nation",
|
|
137
|
-
"tpch_supplier",
|
|
138
|
-
"tpch_customer",
|
|
139
|
-
"tpch_orders",
|
|
139
|
+
f"{db}.tpch_region",
|
|
140
|
+
f"{db}.tpch_nation",
|
|
141
|
+
f"{db}.tpch_supplier",
|
|
142
|
+
f"{db}.tpch_customer",
|
|
143
|
+
f"{db}.tpch_orders",
|
|
140
144
|
}
|
|
141
|
-
assert expected.issubset(
|
|
145
|
+
assert expected.issubset(set(tables))
|
|
142
146
|
|
|
143
147
|
def test_get_schema_columns(self, tpch_setup):
|
|
144
148
|
"""get_schema() should return correct columns for tpch_region."""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|