datajunction-query 0.0.1a57__py3-none-any.whl → 0.0.1a59__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.1a57.dist-info → datajunction_query-0.0.1a59.dist-info}/METADATA +2 -1
- {datajunction_query-0.0.1a57.dist-info → datajunction_query-0.0.1a59.dist-info}/RECORD +11 -11
- djqs/__about__.py +1 -1
- djqs/api/helpers.py +1 -1
- djqs/api/main.py +15 -1
- djqs/api/queries.py +1 -1
- djqs/api/tables.py +8 -2
- djqs/engine.py +1 -6
- {datajunction_query-0.0.1a57.dist-info → datajunction_query-0.0.1a59.dist-info}/WHEEL +0 -0
- {datajunction_query-0.0.1a57.dist-info → datajunction_query-0.0.1a59.dist-info}/licenses/AUTHORS.rst +0 -0
- {datajunction_query-0.0.1a57.dist-info → datajunction_query-0.0.1a59.dist-info}/licenses/LICENSE.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: datajunction-query
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.1a59
|
|
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>
|
|
@@ -32,6 +32,7 @@ Requires-Dist: sqlalchemy<2.0.0,>=1.4.41
|
|
|
32
32
|
Requires-Dist: sqlmodel<1.0.0,>=0.0.8
|
|
33
33
|
Requires-Dist: sqlparse<1.0.0,>=0.4.3
|
|
34
34
|
Requires-Dist: toml>=0.10.2
|
|
35
|
+
Requires-Dist: trino>=0.324.0
|
|
35
36
|
Provides-Extra: uvicorn
|
|
36
37
|
Requires-Dist: uvicorn[standard]>=0.21.1; extra == 'uvicorn'
|
|
37
38
|
Description-Content-Type: text/x-rst
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
djqs/__about__.py,sha256=
|
|
1
|
+
djqs/__about__.py,sha256=Nrz6Fx0WTyvRKH027_G31mp61rrJDScW3VaBMT6rag8,51
|
|
2
2
|
djqs/__init__.py,sha256=nN5-uJoSVEwuc8n-wMygqeF0Xhxi_zqqbCgutZvAt3E,384
|
|
3
3
|
djqs/config.py,sha256=Flva9W8McnTunUlHGhYd0CsgbsjWbZIoPW25ZTzFxws,3029
|
|
4
4
|
djqs/constants.py,sha256=T-sO5C5-NNdEywGglTIu6bjT1VooFwW4XWNA_ZwSYM8,412
|
|
5
|
-
djqs/engine.py,sha256=
|
|
5
|
+
djqs/engine.py,sha256=5HvrFnQmy89j2duPNT-zSktpfl7zKj-FZdeJ5SvFf8M,5719
|
|
6
6
|
djqs/enum.py,sha256=GJVLYDJ2zWjjUBENgyjZZ_94A24BJtvci-AKTmA0zek,590
|
|
7
7
|
djqs/exceptions.py,sha256=z-EjGLRwHL_v3zl1-RICwQis7wUwl3000tse0YwuoBE,4992
|
|
8
8
|
djqs/fixes.py,sha256=TcXnh0I1z4vEAupPatzrvnqyToGihndnxmLJtIn-_Z8,33
|
|
@@ -11,17 +11,17 @@ djqs/utils.py,sha256=R-t2A8RvwLu2Lxcs8r5kxQ7AfuDRKJ7G9XcjfdXAhvQ,2075
|
|
|
11
11
|
djqs/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
12
|
djqs/api/catalogs.py,sha256=I_i8-Nok0V3ND1FpOCQ5Nmgaof5MLH8i0oeTjvDxQgw,3062
|
|
13
13
|
djqs/api/engines.py,sha256=278fsgIgQXe4WAmbfbxoA08ALe57us_zKlaK_hbiDrc,1611
|
|
14
|
-
djqs/api/helpers.py,sha256=
|
|
15
|
-
djqs/api/main.py,sha256=
|
|
16
|
-
djqs/api/queries.py,sha256=
|
|
17
|
-
djqs/api/tables.py,sha256=
|
|
14
|
+
djqs/api/helpers.py,sha256=91UGqs-SAq3fCU9yElBMev9vqtDospOjBq0icfFl1qs,2468
|
|
15
|
+
djqs/api/main.py,sha256=cbZHxkfmushgw8e0G2q8f5Ytexqk-qjKtZPyHK5sbjQ,2075
|
|
16
|
+
djqs/api/queries.py,sha256=gSdzI7pVhCsZDpjP5l0NTvHq4ykF20CFzKiLZrrlUmQ,5523
|
|
17
|
+
djqs/api/tables.py,sha256=1hwYPRAG9kZfS8HE3r_omC4AjHadAbdhFIwx3e4KOvo,1582
|
|
18
18
|
djqs/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
19
|
djqs/models/catalog.py,sha256=o3Wlghwr6ax4Eo-3zE5Mdq478xyUxeaf2o3whFprXtU,2038
|
|
20
20
|
djqs/models/engine.py,sha256=k9cBvnYAfzz4yaBDvErDqXIwlqrRsKRbGikBKTQHJPA,889
|
|
21
21
|
djqs/models/query.py,sha256=Qsy69Cfrkn5myOZZfLrR83JB4ynPXogitUo8A7hRsz8,3338
|
|
22
22
|
djqs/models/table.py,sha256=7HmiXWHBWEthqdwPYLlsOgeKD-w9urCHoC4xaQ1RnM8,238
|
|
23
|
-
datajunction_query-0.0.
|
|
24
|
-
datajunction_query-0.0.
|
|
25
|
-
datajunction_query-0.0.
|
|
26
|
-
datajunction_query-0.0.
|
|
27
|
-
datajunction_query-0.0.
|
|
23
|
+
datajunction_query-0.0.1a59.dist-info/METADATA,sha256=B1aejRaqQXlkkMi5i-os8hqspK6fbjZYoB81vzJPNzA,9495
|
|
24
|
+
datajunction_query-0.0.1a59.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
25
|
+
datajunction_query-0.0.1a59.dist-info/licenses/AUTHORS.rst,sha256=G9YmXPfQ0kAuxqlCwvWVvUnZitP9hAc-rPfZ5q7Pv1U,235
|
|
26
|
+
datajunction_query-0.0.1a59.dist-info/licenses/LICENSE.txt,sha256=KuSxhVgPuUGoYWphJig4POcTAIUNLUj8vOx-cqQFMj8,1081
|
|
27
|
+
datajunction_query-0.0.1a59.dist-info/RECORD,,
|
djqs/__about__.py
CHANGED
djqs/api/helpers.py
CHANGED
|
@@ -58,7 +58,7 @@ def get_columns(
|
|
|
58
58
|
if not uri:
|
|
59
59
|
raise DJException("Cannot retrieve columns without a uri")
|
|
60
60
|
|
|
61
|
-
engine = create_engine(uri,
|
|
61
|
+
engine = create_engine(uri, connect_args=extra_params)
|
|
62
62
|
try:
|
|
63
63
|
inspector = inspect(engine)
|
|
64
64
|
column_metadata = inspector.get_columns(
|
djqs/api/main.py
CHANGED
|
@@ -8,6 +8,7 @@ Main DJ query server app.
|
|
|
8
8
|
# pylint: disable=unused-import,expression-not-assigned
|
|
9
9
|
|
|
10
10
|
import logging
|
|
11
|
+
from contextlib import asynccontextmanager
|
|
11
12
|
|
|
12
13
|
from fastapi import FastAPI, Request
|
|
13
14
|
from fastapi.responses import JSONResponse
|
|
@@ -22,7 +23,19 @@ _logger = logging.getLogger(__name__)
|
|
|
22
23
|
|
|
23
24
|
settings = get_settings()
|
|
24
25
|
session = next(get_session())
|
|
25
|
-
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@asynccontextmanager
|
|
29
|
+
async def lifespan(app: FastAPI): # pylint: disable=W0621,W0613
|
|
30
|
+
"""
|
|
31
|
+
Load DJQS config on app startup
|
|
32
|
+
"""
|
|
33
|
+
try:
|
|
34
|
+
load_djqs_config(settings=settings, session=session)
|
|
35
|
+
except Exception as e: # pylint: disable=W0718
|
|
36
|
+
_logger.warning("Could not load DJQS config: %s", e)
|
|
37
|
+
yield
|
|
38
|
+
|
|
26
39
|
|
|
27
40
|
app = FastAPI(
|
|
28
41
|
title=settings.name,
|
|
@@ -32,6 +45,7 @@ app = FastAPI(
|
|
|
32
45
|
"name": "MIT License",
|
|
33
46
|
"url": "https://mit-license.org/",
|
|
34
47
|
},
|
|
48
|
+
lifespan=lifespan,
|
|
35
49
|
)
|
|
36
50
|
app.include_router(catalogs.get_router)
|
|
37
51
|
app.include_router(engines.get_router)
|
djqs/api/queries.py
CHANGED
djqs/api/tables.py
CHANGED
|
@@ -33,14 +33,20 @@ def table_columns(
|
|
|
33
33
|
f"for `table` must be in the format `<catalog>.<schema>.<table>`",
|
|
34
34
|
)
|
|
35
35
|
settings = get_settings()
|
|
36
|
+
|
|
37
|
+
if engine_version == "":
|
|
38
|
+
version = ""
|
|
39
|
+
else: # pragma: no cover
|
|
40
|
+
version = engine_version or settings.default_reflection_engine_version
|
|
41
|
+
|
|
36
42
|
engine = get_engine(
|
|
37
43
|
session=session,
|
|
38
44
|
name=engine or settings.default_reflection_engine,
|
|
39
|
-
version=
|
|
45
|
+
version=version,
|
|
40
46
|
)
|
|
41
47
|
external_columns = get_columns(
|
|
42
48
|
uri=engine.uri,
|
|
43
|
-
extra_params=
|
|
49
|
+
extra_params=engine.extra_params,
|
|
44
50
|
catalog=table_parts[0],
|
|
45
51
|
schema=table_parts[1],
|
|
46
52
|
table=table_parts[2],
|
djqs/engine.py
CHANGED
|
@@ -14,7 +14,6 @@ from sqlalchemy import create_engine, text
|
|
|
14
14
|
from sqlmodel import Session, select
|
|
15
15
|
|
|
16
16
|
from djqs.config import Settings
|
|
17
|
-
from djqs.models.catalog import Catalog
|
|
18
17
|
from djqs.models.engine import Engine, EngineType
|
|
19
18
|
from djqs.models.query import (
|
|
20
19
|
ColumnMetadata,
|
|
@@ -78,9 +77,6 @@ def run_query(
|
|
|
78
77
|
columns (name and type) and a stream of rows (tuples).
|
|
79
78
|
"""
|
|
80
79
|
_logger.info("Running query on catalog %s", query.catalog_name)
|
|
81
|
-
catalog = session.exec(
|
|
82
|
-
select(Catalog).where(Catalog.name == query.catalog_name),
|
|
83
|
-
).one()
|
|
84
80
|
engine = session.exec(
|
|
85
81
|
select(Engine)
|
|
86
82
|
.where(Engine.name == query.engine_name)
|
|
@@ -104,8 +100,7 @@ def run_query(
|
|
|
104
100
|
cur = conn.cursor()
|
|
105
101
|
|
|
106
102
|
return run_snowflake_query(query, cur)
|
|
107
|
-
|
|
108
|
-
sqla_engine = create_engine(engine.uri, **catalog.extra_params)
|
|
103
|
+
sqla_engine = create_engine(engine.uri, connect_args=engine.extra_params)
|
|
109
104
|
connection = sqla_engine.connect()
|
|
110
105
|
|
|
111
106
|
output: List[Tuple[str, List[ColumnMetadata], Stream]] = []
|
|
File without changes
|
{datajunction_query-0.0.1a57.dist-info → datajunction_query-0.0.1a59.dist-info}/licenses/AUTHORS.rst
RENAMED
|
File without changes
|
{datajunction_query-0.0.1a57.dist-info → datajunction_query-0.0.1a59.dist-info}/licenses/LICENSE.txt
RENAMED
|
File without changes
|