thoth-dbmanager 0.5.9__py3-none-any.whl → 0.5.10__py3-none-any.whl
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.
- thoth_dbmanager/adapters/postgresql.py +27 -27
- {thoth_dbmanager-0.5.9.dist-info → thoth_dbmanager-0.5.10.dist-info}/METADATA +1 -1
- {thoth_dbmanager-0.5.9.dist-info → thoth_dbmanager-0.5.10.dist-info}/RECORD +7 -7
- {thoth_dbmanager-0.5.9.dist-info → thoth_dbmanager-0.5.10.dist-info}/WHEEL +0 -0
- {thoth_dbmanager-0.5.9.dist-info → thoth_dbmanager-0.5.10.dist-info}/licenses/LICENSE +0 -0
- {thoth_dbmanager-0.5.9.dist-info → thoth_dbmanager-0.5.10.dist-info}/licenses/LICENSE.md +0 -0
- {thoth_dbmanager-0.5.9.dist-info → thoth_dbmanager-0.5.10.dist-info}/top_level.txt +0 -0
@@ -176,33 +176,33 @@ class PostgreSQLAdapter(DbAdapter):
|
|
176
176
|
|
177
177
|
|
178
178
|
def get_columns_as_documents(self, table_name: str) -> List[ColumnDocument]:
|
179
|
-
"""Get columns as document objects"""
|
179
|
+
"""Get columns as document objects using pg_catalog to avoid SELECT restrictions"""
|
180
180
|
query = """
|
181
|
-
SELECT
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
COALESCE(pgd.description, '')
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
ORDER BY
|
181
|
+
SELECT
|
182
|
+
a.attname AS column_name,
|
183
|
+
format_type(a.atttypid, a.atttypmod) AS data_type,
|
184
|
+
(NOT a.attnotnull) AS is_nullable,
|
185
|
+
pg_get_expr(d.adbin, d.adrelid) AS column_default,
|
186
|
+
NULL::int AS character_maximum_length,
|
187
|
+
COALESCE(pgd.description, '') AS comment,
|
188
|
+
EXISTS (
|
189
|
+
SELECT 1
|
190
|
+
FROM pg_index i
|
191
|
+
WHERE i.indrelid = c.oid AND i.indisprimary AND a.attnum = ANY(i.indkey)
|
192
|
+
) AS is_pk,
|
193
|
+
n.nspname AS schema_name
|
194
|
+
FROM pg_class c
|
195
|
+
JOIN pg_namespace n ON n.oid = c.relnamespace
|
196
|
+
JOIN pg_attribute a ON a.attrelid = c.oid
|
197
|
+
LEFT JOIN pg_attrdef d ON d.adrelid = c.oid AND d.adnum = a.attnum
|
198
|
+
LEFT JOIN pg_description pgd ON pgd.objoid = c.oid AND pgd.objsubid = a.attnum
|
199
|
+
WHERE c.relname = :table_name
|
200
|
+
AND n.nspname = :schema
|
201
|
+
AND a.attnum > 0
|
202
|
+
AND NOT a.attisdropped
|
203
|
+
ORDER BY a.attnum
|
204
204
|
"""
|
205
|
-
|
205
|
+
|
206
206
|
results = self.execute_query(query, {"table_name": table_name, "schema": self.schema})
|
207
207
|
documents = []
|
208
208
|
|
@@ -212,8 +212,8 @@ class PostgreSQLAdapter(DbAdapter):
|
|
212
212
|
column_name=row.column_name,
|
213
213
|
data_type=row.data_type,
|
214
214
|
comment=row.comment or "",
|
215
|
-
is_pk=row.is_pk,
|
216
|
-
is_nullable=row.is_nullable
|
215
|
+
is_pk=bool(row.is_pk),
|
216
|
+
is_nullable=bool(row.is_nullable),
|
217
217
|
default_value=row.column_default,
|
218
218
|
max_length=row.character_maximum_length,
|
219
219
|
schema_name=row.schema_name
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: thoth_dbmanager
|
3
|
-
Version: 0.5.
|
3
|
+
Version: 0.5.10
|
4
4
|
Summary: A Python library for managing SQL databases with support for multiple database types, LSH-based similarity search, and a modern plugin architecture.
|
5
5
|
Author-email: Marco Pancotti <mp@tylconsulting.it>
|
6
6
|
Project-URL: Homepage, https://github.com/mptyl/thoth_dbmanager
|
@@ -4,7 +4,7 @@ thoth_dbmanager/documents.py,sha256=BnYL9MR9eOl9cNOrY58SgHgXACnHCk_UzKjpfV8RjgY,
|
|
4
4
|
thoth_dbmanager/dynamic_imports.py,sha256=nKCwg3Y2e5f4oP_-9X53t4Z9InbIGDMgidQjeN1Xgoo,7592
|
5
5
|
thoth_dbmanager/adapters/__init__.py,sha256=rfXo8IxWPx2TQV2OwFrZqpOzrkKuO6HR0q8ftkuGhW0,1578
|
6
6
|
thoth_dbmanager/adapters/mariadb.py,sha256=Bc31B4LNzlqu1QwhBP49Ia1jlh-XWh14Q_ya-KqWvsQ,15636
|
7
|
-
thoth_dbmanager/adapters/postgresql.py,sha256=
|
7
|
+
thoth_dbmanager/adapters/postgresql.py,sha256=xUu5_U6guDx27DH6G4txADfQCp0EOuWPxkFgnnRQGJI,18259
|
8
8
|
thoth_dbmanager/adapters/sqlite.py,sha256=sg9ifwBL3L_aBf6i3Z0wq_Z7mTjnVeWhCY1VK6Cfh9E,15147
|
9
9
|
thoth_dbmanager/adapters/sqlserver.py,sha256=VcWW5xudK4_3BuPwX0WcBAxgN6j9seRssvwsWPpJudo,25320
|
10
10
|
thoth_dbmanager/core/__init__.py,sha256=22dsupbGskkjGgS9IzeCwaf5o7nIKH_og1qARZURAFM,848
|
@@ -26,9 +26,9 @@ thoth_dbmanager/plugins/mariadb.py,sha256=OW_u_x3mfaQYH5dUEreUbelPE6KEQU4kiqT3_D
|
|
26
26
|
thoth_dbmanager/plugins/postgresql.py,sha256=VFGiGa1qAWRR00DkoHIAFS-U9uMLMwb5gKa_NB-cQA8,6097
|
27
27
|
thoth_dbmanager/plugins/sqlite.py,sha256=yqqa_lToLabOv_ut2uRTXxhjyEQSVbB8kIcUwy7HNZk,9436
|
28
28
|
thoth_dbmanager/plugins/sqlserver.py,sha256=AxEXwe21FRh6L1lX6-gu3VzcxDQ7dO5YLvLXTrIyaRk,5868
|
29
|
-
thoth_dbmanager-0.5.
|
30
|
-
thoth_dbmanager-0.5.
|
31
|
-
thoth_dbmanager-0.5.
|
32
|
-
thoth_dbmanager-0.5.
|
33
|
-
thoth_dbmanager-0.5.
|
34
|
-
thoth_dbmanager-0.5.
|
29
|
+
thoth_dbmanager-0.5.10.dist-info/licenses/LICENSE,sha256=81-BOzGgwtY1XdYfkwMQB87AkOGXI9OMq0kjNcZA4UE,1071
|
30
|
+
thoth_dbmanager-0.5.10.dist-info/licenses/LICENSE.md,sha256=TtKT2ej3GRki3W8FmSeYzRuQtZ1oMGWchpWykZ4vA7c,1070
|
31
|
+
thoth_dbmanager-0.5.10.dist-info/METADATA,sha256=AGjfF7xBRTDs8SnHzND6VuFvRCzUav0cjaiV2Tdw7r4,14778
|
32
|
+
thoth_dbmanager-0.5.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
33
|
+
thoth_dbmanager-0.5.10.dist-info/top_level.txt,sha256=b9ttxm9RUc0KUCASEKRx6FqoREYJ1-KZWSpNuaM0uQ4,16
|
34
|
+
thoth_dbmanager-0.5.10.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|