sql-testing-tools 0.2.4__tar.gz → 0.2.4a0__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.
- {sql_testing_tools-0.2.4 → sql_testing_tools-0.2.4a0}/PKG-INFO +1 -1
- sql_testing_tools-0.2.4a0/setup.py +27 -0
- {sql_testing_tools-0.2.4 → sql_testing_tools-0.2.4a0}/sql_testing_tools/BaseAccess.py +36 -10
- {sql_testing_tools-0.2.4 → sql_testing_tools-0.2.4a0}/sql_testing_tools.egg-info/PKG-INFO +1 -1
- sql_testing_tools-0.2.4/setup.py +0 -17
- {sql_testing_tools-0.2.4 → sql_testing_tools-0.2.4a0}/README.md +0 -0
- {sql_testing_tools-0.2.4 → sql_testing_tools-0.2.4a0}/setup.cfg +0 -0
- {sql_testing_tools-0.2.4 → sql_testing_tools-0.2.4a0}/sql_testing_tools/Helper.py +0 -0
- {sql_testing_tools-0.2.4 → sql_testing_tools-0.2.4a0}/sql_testing_tools/TokenProcessing.py +0 -0
- {sql_testing_tools-0.2.4 → sql_testing_tools-0.2.4a0}/sql_testing_tools/__init__.py +0 -0
- {sql_testing_tools-0.2.4 → sql_testing_tools-0.2.4a0}/sql_testing_tools.egg-info/SOURCES.txt +0 -0
- {sql_testing_tools-0.2.4 → sql_testing_tools-0.2.4a0}/sql_testing_tools.egg-info/dependency_links.txt +0 -0
- {sql_testing_tools-0.2.4 → sql_testing_tools-0.2.4a0}/sql_testing_tools.egg-info/requires.txt +0 -0
- {sql_testing_tools-0.2.4 → sql_testing_tools-0.2.4a0}/sql_testing_tools.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
with open("README.md", "r") as fh:
|
|
4
|
+
description = fh.read()
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
setup(
|
|
8
|
+
name='sql_testing_tools',
|
|
9
|
+
version='0.2.4.a',
|
|
10
|
+
packages=find_packages(),
|
|
11
|
+
install_requires=[
|
|
12
|
+
'sqlparse>=0.5.1',
|
|
13
|
+
'requests>=2.32.3'
|
|
14
|
+
],
|
|
15
|
+
long_description=description,
|
|
16
|
+
long_description_content_type="text/markdown",
|
|
17
|
+
package_data={
|
|
18
|
+
'sql_testing_tools.databases': [
|
|
19
|
+
'databases/*.db'#,
|
|
20
|
+
#'./databases/bayern.db',
|
|
21
|
+
#'./databases/film_fernsehen.db',
|
|
22
|
+
#'./databases/ladepunkte.db',
|
|
23
|
+
#'./databases/straftaten.db',
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
include_package_data=True
|
|
27
|
+
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import sqlite3
|
|
2
2
|
import os
|
|
3
|
-
|
|
3
|
+
import importlib
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
__db=""
|
|
@@ -9,19 +9,45 @@ def setDBName(path: str):
|
|
|
9
9
|
global __db
|
|
10
10
|
print("Setting DB to: " + path)
|
|
11
11
|
__db = path
|
|
12
|
-
#with resources.path('sql_testing_tools', path) as db_path:
|
|
13
|
-
# __db = str(db_path)
|
|
14
|
-
# print(__db)
|
|
15
12
|
|
|
13
|
+
def checkDbInResources():
|
|
14
|
+
global __db
|
|
15
|
+
|
|
16
|
+
resources = list(importlib.resources.contents('sql_testing_tools.databases'))
|
|
17
|
+
print("Available resources: " + str(resources))
|
|
18
|
+
|
|
19
|
+
newPath = __db.replace("databases/","")
|
|
20
|
+
|
|
21
|
+
if(newPath not in resources):
|
|
22
|
+
print("Database not in resources. Trying to find '"+ __db +"' in the current directory.")
|
|
23
|
+
for root, dirs, files in os.walk('.'):
|
|
24
|
+
for file in files:
|
|
25
|
+
f = os.path.join(root, file)
|
|
26
|
+
print(f)
|
|
27
|
+
if f.endswith(newPath):
|
|
28
|
+
print("Database found in current directory.")
|
|
29
|
+
return False
|
|
30
|
+
else:
|
|
31
|
+
print("Database found in resources.")
|
|
32
|
+
__db = newPath
|
|
33
|
+
return True
|
|
16
34
|
|
|
17
|
-
#setDBName("databases/bayern.db")
|
|
18
35
|
|
|
19
36
|
def run(sql: str):
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
37
|
+
global __db
|
|
38
|
+
if checkDbInResources():
|
|
39
|
+
with importlib.resources.path('sql_testing_tools.databases', __db) as db_path:
|
|
40
|
+
with sqlite3.connect(db_path) as con:
|
|
41
|
+
cur = con.cursor()
|
|
42
|
+
cur.execute(sql)
|
|
43
|
+
con.commit()
|
|
44
|
+
return cur
|
|
45
|
+
else:
|
|
46
|
+
with sqlite3.connect(__db) as con:
|
|
47
|
+
cur = con.cursor()
|
|
48
|
+
cur.execute(sql)
|
|
49
|
+
con.commit()
|
|
50
|
+
return cur
|
|
25
51
|
|
|
26
52
|
def runFromFile(path: str):
|
|
27
53
|
sql = getSQLFromFile(path)
|
sql_testing_tools-0.2.4/setup.py
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
from setuptools import setup, find_packages
|
|
2
|
-
|
|
3
|
-
with open("README.md", "r") as fh:
|
|
4
|
-
description = fh.read()
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
setup(
|
|
8
|
-
name='sql_testing_tools',
|
|
9
|
-
version='0.2.4',
|
|
10
|
-
packages=find_packages(),
|
|
11
|
-
install_requires=[
|
|
12
|
-
'sqlparse>=0.5.1',
|
|
13
|
-
'requests>=2.32.3'
|
|
14
|
-
],
|
|
15
|
-
long_description=description,
|
|
16
|
-
long_description_content_type="text/markdown"
|
|
17
|
-
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sql_testing_tools-0.2.4 → sql_testing_tools-0.2.4a0}/sql_testing_tools.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{sql_testing_tools-0.2.4 → sql_testing_tools-0.2.4a0}/sql_testing_tools.egg-info/requires.txt
RENAMED
|
File without changes
|
{sql_testing_tools-0.2.4 → sql_testing_tools-0.2.4a0}/sql_testing_tools.egg-info/top_level.txt
RENAMED
|
File without changes
|