quillsql 2.2.5__tar.gz → 2.2.6__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.
Files changed (26) hide show
  1. {quillsql-2.2.5 → quillsql-2.2.6}/PKG-INFO +1 -1
  2. {quillsql-2.2.5 → quillsql-2.2.6}/quillsql/core.py +12 -1
  3. {quillsql-2.2.5 → quillsql-2.2.6}/quillsql/db/bigquery.py +1 -2
  4. {quillsql-2.2.5 → quillsql-2.2.6}/quillsql/db/db_helper.py +15 -11
  5. {quillsql-2.2.5 → quillsql-2.2.6}/quillsql/utils/pivot_template.py +0 -1
  6. {quillsql-2.2.5 → quillsql-2.2.6}/quillsql.egg-info/PKG-INFO +1 -1
  7. {quillsql-2.2.5 → quillsql-2.2.6}/setup.py +1 -1
  8. {quillsql-2.2.5 → quillsql-2.2.6}/README.md +0 -0
  9. {quillsql-2.2.5 → quillsql-2.2.6}/quillsql/__init__.py +0 -0
  10. {quillsql-2.2.5 → quillsql-2.2.6}/quillsql/assets/__init__.py +0 -0
  11. {quillsql-2.2.5 → quillsql-2.2.6}/quillsql/assets/pgtypes.py +0 -0
  12. {quillsql-2.2.5 → quillsql-2.2.6}/quillsql/db/__init__.py +0 -0
  13. {quillsql-2.2.5 → quillsql-2.2.6}/quillsql/db/cached_connection.py +0 -0
  14. {quillsql-2.2.5 → quillsql-2.2.6}/quillsql/db/postgres.py +0 -0
  15. {quillsql-2.2.5 → quillsql-2.2.6}/quillsql/error.py +0 -0
  16. {quillsql-2.2.5 → quillsql-2.2.6}/quillsql/utils/__init__.py +0 -0
  17. {quillsql-2.2.5 → quillsql-2.2.6}/quillsql/utils/filters.py +0 -0
  18. {quillsql-2.2.5 → quillsql-2.2.6}/quillsql/utils/run_query_processes.py +0 -0
  19. {quillsql-2.2.5 → quillsql-2.2.6}/quillsql/utils/schema_conversion.py +0 -0
  20. {quillsql-2.2.5 → quillsql-2.2.6}/quillsql/utils/tenants.py +0 -0
  21. {quillsql-2.2.5 → quillsql-2.2.6}/quillsql.egg-info/SOURCES.txt +0 -0
  22. {quillsql-2.2.5 → quillsql-2.2.6}/quillsql.egg-info/dependency_links.txt +0 -0
  23. {quillsql-2.2.5 → quillsql-2.2.6}/quillsql.egg-info/requires.txt +0 -0
  24. {quillsql-2.2.5 → quillsql-2.2.6}/quillsql.egg-info/top_level.txt +0 -0
  25. {quillsql-2.2.5 → quillsql-2.2.6}/setup.cfg +0 -0
  26. {quillsql-2.2.5 → quillsql-2.2.6}/tests/test_core.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quillsql
3
- Version: 2.2.5
3
+ Version: 2.2.6
4
4
  Summary: Quill SDK for Python.
5
5
  Home-page: https://github.com/quill-sql/quill-python
6
6
  Author: Quill
@@ -396,13 +396,24 @@ class Quill:
396
396
  return query
397
397
  return f"{query.rstrip(';')} limit {limit}"
398
398
 
399
+ def normalize_database_type(self, db_type):
400
+ if not db_type:
401
+ return None
402
+ lowered = db_type.lower()
403
+ if lowered in ("postgresql", "postgres"):
404
+ return "postgres"
405
+ return lowered
406
+
399
407
  def run_queries(
400
408
  self, queries, pkDatabaseType, databaseType=None, metadata=None, runQueryConfig=None
401
409
  ):
402
410
  results = {}
403
411
  if not queries:
404
412
  return {"queryResults": []}
405
- if databaseType and databaseType.lower() != pkDatabaseType.lower():
413
+ normalized_pk = self.normalize_database_type(pkDatabaseType)
414
+ normalized_requested = self.normalize_database_type(databaseType)
415
+ should_enforce_match = normalized_requested is not None
416
+ if should_enforce_match and normalized_requested != normalized_pk:
406
417
  return {"dbMismatched": True, "backendDatabaseType": pkDatabaseType}
407
418
  if runQueryConfig and runQueryConfig.get("arrayToMap"):
408
419
  mapped_array = array_to_map(
@@ -26,8 +26,7 @@ def format_bigquery_config(connection_string):
26
26
  "project": service_account.get("project_id"),
27
27
  "credentials": service_account,
28
28
  }
29
- except (ValueError, TypeError) as e:
30
- print("Invalid JSON string: ", e)
29
+ except (ValueError, TypeError):
31
30
  return connection_string
32
31
 
33
32
 
@@ -15,47 +15,51 @@ from quillsql.db.bigquery import (
15
15
  )
16
16
 
17
17
 
18
+ def _is_postgres(database_type):
19
+ return database_type and database_type.lower() in ("postgresql", "postgres")
20
+
21
+
18
22
  def get_db_credentials(database_type, connection_string):
19
- if database_type.lower() == "postgresql":
23
+ if _is_postgres(database_type):
20
24
  return format_postgres(connection_string)
21
- elif database_type.lower() == "bigquery":
25
+ elif database_type and database_type.lower() == "bigquery":
22
26
  return format_bigquery_config(connection_string)
23
27
  return {}
24
28
 
25
29
 
26
30
  def connect_to_db(database_type, config, using_connection_string):
27
- if database_type.lower() == "postgresql":
31
+ if _is_postgres(database_type):
28
32
  return connect_to_postgres(config, using_connection_string)
29
- elif database_type.lower() == "bigquery":
33
+ elif database_type and database_type.lower() == "bigquery":
30
34
  return connect_to_bigquery(config, using_connection_string)
31
35
  return None
32
36
 
33
37
 
34
38
  def run_query_by_db(database_type, query, connection):
35
- if database_type.lower() == "postgresql":
39
+ if _is_postgres(database_type):
36
40
  return run_query_postgres(query, connection)
37
- elif database_type.lower() == "bigquery":
41
+ elif database_type and database_type.lower() == "bigquery":
38
42
  return run_query_big_query(query, connection)
39
43
  return None
40
44
 
41
45
 
42
46
  def disconnect_from_db(database_type, connection):
43
- if database_type.lower() == "postgresql":
47
+ if _is_postgres(database_type):
44
48
  return disconnect_from_postgres(connection)
45
49
  return None
46
50
 
47
51
 
48
52
  def get_schema_tables_by_db(database_type, connection, schema_name):
49
- if database_type.lower() == "postgresql":
53
+ if _is_postgres(database_type):
50
54
  return get_tables_by_schema_postgres(connection, schema_name)
51
- elif database_type.lower() == "bigquery":
55
+ elif database_type and database_type.lower() == "bigquery":
52
56
  return get_tables_by_schema_big_query(connection, schema_name)
53
57
  return None
54
58
 
55
59
 
56
60
  def get_schema_column_info_by_db(database_type, connection, schema_name, table_names):
57
- if database_type.lower() == "postgresql":
61
+ if _is_postgres(database_type):
58
62
  return get_schema_column_info_postgres(connection, schema_name, table_names)
59
- elif database_type.lower() == "bigquery":
63
+ elif database_type and database_type.lower() == "bigquery":
60
64
  return get_schema_column_info_big_query(connection, schema_name, table_names)
61
65
  return None
@@ -198,7 +198,6 @@ def parse_distinct_values(query_result: Dict[str, Any], database_type: str) -> L
198
198
  distinct_values = [v.strip() for v in row["string_values"].split(",")]
199
199
 
200
200
  else:
201
- print(f"Warning: Unknown database type: {database_type}")
202
201
  distinct_values = []
203
202
 
204
203
  # Filter out null/undefined/empty values
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quillsql
3
- Version: 2.2.5
3
+ Version: 2.2.6
4
4
  Summary: Quill SDK for Python.
5
5
  Home-page: https://github.com/quill-sql/quill-python
6
6
  Author: Quill
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="quillsql",
5
- version="2.2.5",
5
+ version="2.2.6",
6
6
  packages=find_packages(),
7
7
  install_requires=[
8
8
  "psycopg2-binary",
File without changes
File without changes
File without changes
File without changes
File without changes