zaturn 0.1.6__py3-none-any.whl → 0.1.7__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.
- zaturn/config.py +2 -1
- zaturn/core.py +1 -1
- zaturn/query_utils.py +3 -7
- {zaturn-0.1.6.dist-info → zaturn-0.1.7.dist-info}/METADATA +1 -1
- zaturn-0.1.7.dist-info/RECORD +12 -0
- {zaturn-0.1.6.dist-info → zaturn-0.1.7.dist-info}/WHEEL +1 -1
- zaturn-0.1.6.dist-info/RECORD +0 -12
- {zaturn-0.1.6.dist-info → zaturn-0.1.7.dist-info}/entry_points.txt +0 -0
- {zaturn-0.1.6.dist-info → zaturn-0.1.7.dist-info}/licenses/LICENSE +0 -0
- {zaturn-0.1.6.dist-info → zaturn-0.1.7.dist-info}/top_level.txt +0 -0
zaturn/config.py
CHANGED
@@ -59,8 +59,9 @@ for s in source_list:
|
|
59
59
|
elif source.startswith('postgresql://'):
|
60
60
|
source_type = 'postgresql'
|
61
61
|
source_name = source.split('/')[-1].split('?')[0]
|
62
|
-
elif source.startswith("mysql+pymysql://"):
|
62
|
+
elif source.startswith("mysql://") or source.startswith("mysql+pymysql://"):
|
63
63
|
source_type = 'mysql'
|
64
|
+
s = s.replace('mysql://', 'mysql+pymysql://')
|
64
65
|
source_name = source.split('/')[-1].split('?')[0]
|
65
66
|
elif source.startswith('clickhouse://'):
|
66
67
|
source_type = 'clickhouse'
|
zaturn/core.py
CHANGED
@@ -86,7 +86,7 @@ def describe_table(source_id: str, table_name: str) -> str:
|
|
86
86
|
match source['type']:
|
87
87
|
case 'sqlite':
|
88
88
|
result = query_utils.execute_query(source,
|
89
|
-
f
|
89
|
+
f'PRAGMA table_info({table_name});'
|
90
90
|
)
|
91
91
|
return result.to_markdown(index=False)
|
92
92
|
|
zaturn/query_utils.py
CHANGED
@@ -13,16 +13,11 @@ from zaturn import config
|
|
13
13
|
def execute_query(source: dict, query: str):
|
14
14
|
"""Run the query using the appropriate engine and read only config"""
|
15
15
|
url = source['url']
|
16
|
-
|
16
|
+
|
17
17
|
match source['type']:
|
18
18
|
case "sqlite":
|
19
|
-
if "mode=ro" in url:
|
20
|
-
pass
|
21
|
-
elif '?' in url:
|
22
|
-
url += '&mode=ro'
|
23
|
-
else:
|
24
|
-
url += '?mode=ro'
|
25
19
|
with sqlalchemy.create_engine(url).connect() as conn:
|
20
|
+
conn.execute(sqlalchemy.text('PRAGMA query_only = ON;'))
|
26
21
|
result = conn.execute(sqlalchemy.text(query))
|
27
22
|
return pd.DataFrame(result)
|
28
23
|
|
@@ -32,6 +27,7 @@ def execute_query(source: dict, query: str):
|
|
32
27
|
session.autoflush = False
|
33
28
|
session.autocommit = False
|
34
29
|
session.flush = lambda *args: None
|
30
|
+
session.execute(sqlalchemy.text('SET SESSION TRANSACTION READ ONLY;'))
|
35
31
|
result = session.execute(sqlalchemy.text(query))
|
36
32
|
return pd.DataFrame(result)
|
37
33
|
|
@@ -0,0 +1,12 @@
|
|
1
|
+
zaturn/__init__.py,sha256=v4t5fkRuIJFE-SBxCa5pBjZv0EoC0eWK75nU9iaa7Rg,267
|
2
|
+
zaturn/config.py,sha256=qdFy7GyGyXO-rEyqb8kO3wym3DEk2nQEiz-JscDKjaw,3446
|
3
|
+
zaturn/core.py,sha256=MNB37smt4wkdHCTsZECesrksnx0FnCnHBw4kkWOTvTQ,4671
|
4
|
+
zaturn/query_utils.py,sha256=4o37eGV8X1sbYvme_jKaPX8hdlynfzMK_0qCSf6XZlo,3031
|
5
|
+
zaturn/visualizations.py,sha256=0ON70D_mK4o0oyfEKqAhr2jkKWz_5-kNKkD6_TGBR9k,5014
|
6
|
+
zaturn/example_data/all_pokemon_data.csv,sha256=SUlGHHWbehuLg-ch1YUrQ6-xBtqHGw6rIkyn70fAgCk,130893
|
7
|
+
zaturn-0.1.7.dist-info/licenses/LICENSE,sha256=mZSuFlbEBZGl0-8ULRMLdRDbhau5hrWRNQOjytYeaug,1070
|
8
|
+
zaturn-0.1.7.dist-info/METADATA,sha256=b_pULTQiosZBRg6lZSAWVD23HxRmjercbL3bj06wOHE,7179
|
9
|
+
zaturn-0.1.7.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
|
10
|
+
zaturn-0.1.7.dist-info/entry_points.txt,sha256=N1UZC2zvod92_Brs4A2xZiAnt-iGLBNryglXfwhxfj4,43
|
11
|
+
zaturn-0.1.7.dist-info/top_level.txt,sha256=KLUnwQwVZkfd5YCnnqR35MOOs8KLhanPGelvmRo2MVA,7
|
12
|
+
zaturn-0.1.7.dist-info/RECORD,,
|
zaturn-0.1.6.dist-info/RECORD
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
zaturn/__init__.py,sha256=v4t5fkRuIJFE-SBxCa5pBjZv0EoC0eWK75nU9iaa7Rg,267
|
2
|
-
zaturn/config.py,sha256=V0sqe72zCLyHVJyH27vOR401hA7NnRhkfaJlIeyNoXo,3359
|
3
|
-
zaturn/core.py,sha256=hASmXF6iMQA5M62tf94YjE5D3Rja9Vj5-8zMVKQ_tOY,4671
|
4
|
-
zaturn/query_utils.py,sha256=zXy8-eDpqpehgdHBs0zjLPfpLDsbF4xtiCEU1dE0xms,3028
|
5
|
-
zaturn/visualizations.py,sha256=0ON70D_mK4o0oyfEKqAhr2jkKWz_5-kNKkD6_TGBR9k,5014
|
6
|
-
zaturn/example_data/all_pokemon_data.csv,sha256=SUlGHHWbehuLg-ch1YUrQ6-xBtqHGw6rIkyn70fAgCk,130893
|
7
|
-
zaturn-0.1.6.dist-info/licenses/LICENSE,sha256=mZSuFlbEBZGl0-8ULRMLdRDbhau5hrWRNQOjytYeaug,1070
|
8
|
-
zaturn-0.1.6.dist-info/METADATA,sha256=tO7Fc7dIV_YumwTavFxKWQMGEitbDBE82zDv1J_vEVw,7179
|
9
|
-
zaturn-0.1.6.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
|
10
|
-
zaturn-0.1.6.dist-info/entry_points.txt,sha256=N1UZC2zvod92_Brs4A2xZiAnt-iGLBNryglXfwhxfj4,43
|
11
|
-
zaturn-0.1.6.dist-info/top_level.txt,sha256=KLUnwQwVZkfd5YCnnqR35MOOs8KLhanPGelvmRo2MVA,7
|
12
|
-
zaturn-0.1.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|