quillsql 2.2.3__tar.gz → 2.2.4__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.3 → quillsql-2.2.4}/PKG-INFO +1 -1
  2. {quillsql-2.2.3 → quillsql-2.2.4}/quillsql/core.py +11 -9
  3. {quillsql-2.2.3 → quillsql-2.2.4}/quillsql.egg-info/PKG-INFO +1 -1
  4. {quillsql-2.2.3 → quillsql-2.2.4}/setup.py +1 -1
  5. {quillsql-2.2.3 → quillsql-2.2.4}/tests/test_core.py +45 -0
  6. {quillsql-2.2.3 → quillsql-2.2.4}/README.md +0 -0
  7. {quillsql-2.2.3 → quillsql-2.2.4}/quillsql/__init__.py +0 -0
  8. {quillsql-2.2.3 → quillsql-2.2.4}/quillsql/assets/__init__.py +0 -0
  9. {quillsql-2.2.3 → quillsql-2.2.4}/quillsql/assets/pgtypes.py +0 -0
  10. {quillsql-2.2.3 → quillsql-2.2.4}/quillsql/db/__init__.py +0 -0
  11. {quillsql-2.2.3 → quillsql-2.2.4}/quillsql/db/bigquery.py +0 -0
  12. {quillsql-2.2.3 → quillsql-2.2.4}/quillsql/db/cached_connection.py +0 -0
  13. {quillsql-2.2.3 → quillsql-2.2.4}/quillsql/db/db_helper.py +0 -0
  14. {quillsql-2.2.3 → quillsql-2.2.4}/quillsql/db/postgres.py +0 -0
  15. {quillsql-2.2.3 → quillsql-2.2.4}/quillsql/error.py +0 -0
  16. {quillsql-2.2.3 → quillsql-2.2.4}/quillsql/utils/__init__.py +0 -0
  17. {quillsql-2.2.3 → quillsql-2.2.4}/quillsql/utils/filters.py +0 -0
  18. {quillsql-2.2.3 → quillsql-2.2.4}/quillsql/utils/pivot_template.py +0 -0
  19. {quillsql-2.2.3 → quillsql-2.2.4}/quillsql/utils/run_query_processes.py +0 -0
  20. {quillsql-2.2.3 → quillsql-2.2.4}/quillsql/utils/schema_conversion.py +0 -0
  21. {quillsql-2.2.3 → quillsql-2.2.4}/quillsql/utils/tenants.py +0 -0
  22. {quillsql-2.2.3 → quillsql-2.2.4}/quillsql.egg-info/SOURCES.txt +0 -0
  23. {quillsql-2.2.3 → quillsql-2.2.4}/quillsql.egg-info/dependency_links.txt +0 -0
  24. {quillsql-2.2.3 → quillsql-2.2.4}/quillsql.egg-info/requires.txt +0 -0
  25. {quillsql-2.2.3 → quillsql-2.2.4}/quillsql.egg-info/top_level.txt +0 -0
  26. {quillsql-2.2.3 → quillsql-2.2.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quillsql
3
- Version: 2.2.3
3
+ Version: 2.2.4
4
4
  Summary: Quill SDK for Python.
5
5
  Home-page: https://github.com/quill-sql/quill-python
6
6
  Author: Quill
@@ -129,13 +129,14 @@ class Quill:
129
129
  return {
130
130
  "status": "error",
131
131
  "error": pivot_template_response.get("error"),
132
- "data": pivot_template_response.get("metadata") or {},
132
+ "data": (pivot_template_response.get("metadata") or {}),
133
133
  }
134
134
 
135
- template = pivot_template_response.get("metadata", {}).get("template")
136
- config = pivot_template_response.get("metadata", {}).get("config")
137
- distinct_values_query = pivot_template_response.get("metadata", {}).get("distinctValuesQuery")
138
- row_count_query = pivot_template_response.get("metadata", {}).get("rowCountQuery")
135
+ pivot_metadata = pivot_template_response.get("metadata") or {}
136
+ template = pivot_metadata.get("template")
137
+ config = pivot_metadata.get("config") or {}
138
+ distinct_values_query = pivot_metadata.get("distinctValuesQuery")
139
+ row_count_query = pivot_metadata.get("rowCountQuery")
139
140
 
140
141
  # Step 2: Run the distinct values query to get unique values
141
142
  distinct_values = []
@@ -180,10 +181,10 @@ class Quill:
180
181
  self.target_connection.database_type,
181
182
  metadata.get("databaseType"),
182
183
  metadata,
183
- pivot_template_response.get("metadata", {}).get("runQueryConfig")
184
+ pivot_metadata.get("runQueryConfig"),
184
185
  )
185
186
 
186
- responseMetadata = pivot_template_response.get("metadata") or {}
187
+ responseMetadata = pivot_metadata or {}
187
188
  # Set rows and fields from first query result (the pivot query)
188
189
  if final_results.get("queryResults") and len(final_results["queryResults"]) >= 1:
189
190
  query_results = final_results["queryResults"][0]
@@ -228,7 +229,7 @@ class Quill:
228
229
  return {
229
230
  'status': 'error',
230
231
  'error': response.get('error'),
231
- 'data': response.get('metadata') or {},
232
+ 'data': (response.get('metadata') or {}),
232
233
  }
233
234
 
234
235
  flag_query_results = self.run_queries(
@@ -237,7 +238,8 @@ class Quill:
237
238
  )
238
239
 
239
240
  tenant_flags = []
240
- query_order = response.get('metadata', {}).get('queryOrder') or []
241
+ response_metadata = response.get('metadata') or {}
242
+ query_order = response_metadata.get('queryOrder') or []
241
243
  query_results = (flag_query_results or {}).get('queryResults') or []
242
244
  for tenant_field, query_result in zip(query_order, query_results):
243
245
  rows = []
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quillsql
3
- Version: 2.2.3
3
+ Version: 2.2.4
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.3",
5
+ version="2.2.4",
6
6
  packages=find_packages(),
7
7
  install_requires=[
8
8
  "psycopg2-binary",
@@ -51,3 +51,48 @@ def test_query_handles_none_tenant_flag_responses(mock_cached_connection):
51
51
  assert result["status"] == "success"
52
52
  assert result["data"] == {}
53
53
 
54
+
55
+ @patch("quillsql.core.CachedConnection")
56
+ def test_query_handles_tenant_flag_metadata_none(mock_cached_connection):
57
+ mock_connection = MagicMock()
58
+ mock_connection.database_type = "PostgreSQL"
59
+ mock_cached_connection.return_value = mock_connection
60
+
61
+ quill = Quill(
62
+ private_key="test-key",
63
+ database_type="PostgreSQL",
64
+ database_config={},
65
+ )
66
+
67
+ quill.run_queries = MagicMock(
68
+ side_effect=[
69
+ {"queryResults": [{"rows": [{"quill_flag": "alpha"}]}]},
70
+ {"queryResults": []},
71
+ ]
72
+ )
73
+
74
+ def post_quill_side_effect(path, payload):
75
+ if path == "tenant-mapped-flags":
76
+ return {
77
+ "queries": [
78
+ 'SELECT * FROM (SELECT "id" AS "customer_id", "name" AS "quill_label", "id" AS "quill_flag" FROM "public"."customers") AS "subq_owner_query" WHERE "customer_id" IN (2)'
79
+ ],
80
+ "metadata": None,
81
+ }
82
+ return {"queries": [], "metadata": {}}
83
+
84
+ quill.post_quill = MagicMock(side_effect=post_quill_side_effect)
85
+
86
+ result = quill.query(
87
+ tenants=[{"tenantField": "customer_id", "tenantIds": [2]}],
88
+ metadata={
89
+ "task": "report",
90
+ "clientId": "client-123",
91
+ "reportId": "report-456",
92
+ "databaseType": "PostgreSQL",
93
+ },
94
+ )
95
+
96
+ assert result["status"] == "success"
97
+ assert result["data"] == {}
98
+
File without changes
File without changes
File without changes
File without changes