datajunction-query 0.0.1a30__py3-none-any.whl → 0.0.1a32__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.
Potentially problematic release.
This version of datajunction-query might be problematic. Click here for more details.
- {datajunction_query-0.0.1a30.dist-info → datajunction_query-0.0.1a32.dist-info}/METADATA +3 -2
- {datajunction_query-0.0.1a30.dist-info → datajunction_query-0.0.1a32.dist-info}/RECORD +8 -8
- djqs/__about__.py +1 -1
- djqs/engine.py +25 -0
- djqs/models/engine.py +1 -0
- {datajunction_query-0.0.1a30.dist-info → datajunction_query-0.0.1a32.dist-info}/WHEEL +0 -0
- {datajunction_query-0.0.1a30.dist-info → datajunction_query-0.0.1a32.dist-info}/licenses/AUTHORS.rst +0 -0
- {datajunction_query-0.0.1a30.dist-info → datajunction_query-0.0.1a32.dist-info}/licenses/LICENSE.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: datajunction-query
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.1a32
|
|
4
4
|
Summary: OSS Implementation of a DataJunction Query Service
|
|
5
5
|
Project-URL: repository, https://github.com/DataJunction/dj
|
|
6
6
|
Author-email: DataJunction Authors <roberto@dealmeida.net>
|
|
@@ -22,10 +22,11 @@ Requires-Dist: duckdb==0.8.1
|
|
|
22
22
|
Requires-Dist: fastapi>=0.79.0
|
|
23
23
|
Requires-Dist: importlib-metadata
|
|
24
24
|
Requires-Dist: msgpack>=1.0.3
|
|
25
|
-
Requires-Dist: pyspark==3.3.2
|
|
26
25
|
Requires-Dist: python-dotenv==0.19.2
|
|
26
|
+
Requires-Dist: pyyaml==5.3.1
|
|
27
27
|
Requires-Dist: requests<=2.29.0,>=2.28.2
|
|
28
28
|
Requires-Dist: rich>=10.16.2
|
|
29
|
+
Requires-Dist: snowflake-connector-python>=3.3.1
|
|
29
30
|
Requires-Dist: sqlalchemy-utils>=0.37.7
|
|
30
31
|
Requires-Dist: sqlalchemy<2.0.0,>=1.4.41
|
|
31
32
|
Requires-Dist: sqlmodel<1.0.0,>=0.0.8
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
alembic/env.py,sha256=cUXPBnE3hXpjINWb4vD8TKE7w3UnkYOjwT9DLa7Y5lg,2207
|
|
2
2
|
alembic/versions/2023_02_28_0541-a7e11a2438b4_initial_migration.py,sha256=DRkvqqkbe8xhj34Y09NGqCv7Ohn73Ez2IuMEMNqgu1A,3146
|
|
3
3
|
alembic/versions/2023_10_09_1858-f3407a1ec625_add_type_and_extra_para_ms_field_for_.py,sha256=HBdeQDzSALCGxUl6p7qSBhjWwtwIoh4QukGRNydg7fw,979
|
|
4
|
-
djqs/__about__.py,sha256=
|
|
4
|
+
djqs/__about__.py,sha256=wvEEZ4N9HskYsGiXssnRYtY1BQjuNRNXJziB4NU47dE,51
|
|
5
5
|
djqs/__init__.py,sha256=nN5-uJoSVEwuc8n-wMygqeF0Xhxi_zqqbCgutZvAt3E,384
|
|
6
6
|
djqs/config.py,sha256=Flva9W8McnTunUlHGhYd0CsgbsjWbZIoPW25ZTzFxws,3029
|
|
7
7
|
djqs/constants.py,sha256=T-sO5C5-NNdEywGglTIu6bjT1VooFwW4XWNA_ZwSYM8,412
|
|
8
|
-
djqs/engine.py,sha256=
|
|
8
|
+
djqs/engine.py,sha256=0yYHMIa9UHn3VL7_SubwYntfnQgQp4GH5ez1_3mKKwE,5857
|
|
9
9
|
djqs/exceptions.py,sha256=oHVFngJJGIPmZL7-AwpW9UnP0FDcncbjPcWJpv1SXAU,4888
|
|
10
10
|
djqs/fixes.py,sha256=TcXnh0I1z4vEAupPatzrvnqyToGihndnxmLJtIn-_Z8,33
|
|
11
11
|
djqs/typing.py,sha256=ByasjhXZza2VeRCj1mMhYeCTuW_xXc5P6OblyLYqtu4,6217
|
|
@@ -19,14 +19,14 @@ djqs/api/queries.py,sha256=NAZd2T9_CgWYKsxH7RxTUj6SIA2t8C4HEZHl_n47LL8,5485
|
|
|
19
19
|
djqs/api/tables.py,sha256=5qADafYVkOBaPhq1s9s3Tf_RuTE1Eiqnnvi5bUYB7Io,1457
|
|
20
20
|
djqs/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
21
21
|
djqs/models/catalog.py,sha256=o3Wlghwr6ax4Eo-3zE5Mdq478xyUxeaf2o3whFprXtU,2038
|
|
22
|
-
djqs/models/engine.py,sha256=
|
|
22
|
+
djqs/models/engine.py,sha256=k9cBvnYAfzz4yaBDvErDqXIwlqrRsKRbGikBKTQHJPA,889
|
|
23
23
|
djqs/models/query.py,sha256=FeOOhVGAU8lOajcVYrd2GsOz_XcSWHDy8-t74mGKhhw,3332
|
|
24
24
|
djqs/models/table.py,sha256=7HmiXWHBWEthqdwPYLlsOgeKD-w9urCHoC4xaQ1RnM8,238
|
|
25
25
|
docker/duckdb_load.py,sha256=xOX5fCsJkrWa_7kYF6FEqkK8GWn2S1CmjvRCRIpLmxc,229
|
|
26
26
|
docker/spark_load_roads.py,sha256=PN5D0eZw1MrXZ4Cax4aZGBWyRMwHVVVJBlugraQhiu8,574
|
|
27
27
|
scripts/generate-openapi.py,sha256=m2P1EEFbF6glwmZj6ywoteo8OLvT-7b0IaooWQWqwU4,622
|
|
28
|
-
datajunction_query-0.0.
|
|
29
|
-
datajunction_query-0.0.
|
|
30
|
-
datajunction_query-0.0.
|
|
31
|
-
datajunction_query-0.0.
|
|
32
|
-
datajunction_query-0.0.
|
|
28
|
+
datajunction_query-0.0.1a32.dist-info/METADATA,sha256=F08Y2SUZNotWdNqWNvW6I7Bd7C6pKVzIOg1jOFvNlxc,9465
|
|
29
|
+
datajunction_query-0.0.1a32.dist-info/WHEEL,sha256=9QBuHhg6FNW7lppboF2vKVbCGTVzsFykgRQjjlajrhA,87
|
|
30
|
+
datajunction_query-0.0.1a32.dist-info/licenses/AUTHORS.rst,sha256=G9YmXPfQ0kAuxqlCwvWVvUnZitP9hAc-rPfZ5q7Pv1U,235
|
|
31
|
+
datajunction_query-0.0.1a32.dist-info/licenses/LICENSE.txt,sha256=KuSxhVgPuUGoYWphJig4POcTAIUNLUj8vOx-cqQFMj8,1081
|
|
32
|
+
datajunction_query-0.0.1a32.dist-info/RECORD,,
|
djqs/__about__.py
CHANGED
djqs/engine.py
CHANGED
|
@@ -3,10 +3,12 @@ Query related functions.
|
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
5
|
import logging
|
|
6
|
+
import os
|
|
6
7
|
from datetime import datetime, timezone
|
|
7
8
|
from typing import List, Tuple
|
|
8
9
|
|
|
9
10
|
import duckdb
|
|
11
|
+
import snowflake.connector
|
|
10
12
|
import sqlparse
|
|
11
13
|
from sqlalchemy import create_engine, text
|
|
12
14
|
from sqlmodel import Session, select
|
|
@@ -94,6 +96,15 @@ def run_query(
|
|
|
94
96
|
)
|
|
95
97
|
)
|
|
96
98
|
return run_duckdb_query(query, conn)
|
|
99
|
+
if engine.type == EngineType.SNOWFLAKE:
|
|
100
|
+
conn = snowflake.connector.connect(
|
|
101
|
+
**engine.extra_params,
|
|
102
|
+
password=os.getenv("SNOWSQL_PWD"),
|
|
103
|
+
)
|
|
104
|
+
cur = conn.cursor()
|
|
105
|
+
|
|
106
|
+
return run_snowflake_query(query, cur)
|
|
107
|
+
|
|
97
108
|
sqla_engine = create_engine(engine.uri, **catalog.extra_params)
|
|
98
109
|
connection = sqla_engine.connect()
|
|
99
110
|
|
|
@@ -128,6 +139,20 @@ def run_duckdb_query(
|
|
|
128
139
|
return output
|
|
129
140
|
|
|
130
141
|
|
|
142
|
+
def run_snowflake_query(
|
|
143
|
+
query: Query,
|
|
144
|
+
cur: snowflake.connector.cursor.SnowflakeCursor,
|
|
145
|
+
) -> List[Tuple[str, List[ColumnMetadata], Stream]]:
|
|
146
|
+
"""
|
|
147
|
+
Run a query against a snowflake warehouse
|
|
148
|
+
"""
|
|
149
|
+
output: List[Tuple[str, List[ColumnMetadata], Stream]] = []
|
|
150
|
+
rows = cur.execute(query.submitted_query).fetchall()
|
|
151
|
+
columns: List[ColumnMetadata] = []
|
|
152
|
+
output.append((query.submitted_query, columns, rows))
|
|
153
|
+
return output
|
|
154
|
+
|
|
155
|
+
|
|
131
156
|
def process_query(
|
|
132
157
|
session: Session,
|
|
133
158
|
settings: Settings,
|
djqs/models/engine.py
CHANGED
|
File without changes
|
{datajunction_query-0.0.1a30.dist-info → datajunction_query-0.0.1a32.dist-info}/licenses/AUTHORS.rst
RENAMED
|
File without changes
|
{datajunction_query-0.0.1a30.dist-info → datajunction_query-0.0.1a32.dist-info}/licenses/LICENSE.txt
RENAMED
|
File without changes
|