sqlutilpy 0.21.0__tar.gz → 0.22.0__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.
- {sqlutilpy-0.21.0/py/sqlutilpy.egg-info → sqlutilpy-0.22.0}/PKG-INFO +32 -19
- {sqlutilpy-0.21.0 → sqlutilpy-0.22.0}/README.md +27 -14
- sqlutilpy-0.22.0/pyproject.toml +32 -0
- sqlutilpy-0.22.0/setup.cfg +4 -0
- sqlutilpy-0.22.0/src/sqlutilpy/version.py +1 -0
- {sqlutilpy-0.21.0 → sqlutilpy-0.22.0/src/sqlutilpy.egg-info}/PKG-INFO +32 -19
- sqlutilpy-0.22.0/src/sqlutilpy.egg-info/SOURCES.txt +15 -0
- sqlutilpy-0.22.0/tests/test_pg.py +426 -0
- sqlutilpy-0.22.0/tests/test_sqlite.py +37 -0
- sqlutilpy-0.21.0/py/sqlutilpy/version.py +0 -1
- sqlutilpy-0.21.0/py/sqlutilpy.egg-info/SOURCES.txt +0 -16
- sqlutilpy-0.21.0/requirements.txt +0 -3
- sqlutilpy-0.21.0/setup.cfg +0 -7
- sqlutilpy-0.21.0/setup.py +0 -65
- sqlutilpy-0.21.0/tests/sqlutil_test.py +0 -439
- {sqlutilpy-0.21.0 → sqlutilpy-0.22.0}/LICENSE.txt +0 -0
- {sqlutilpy-0.21.0 → sqlutilpy-0.22.0}/MANIFEST.in +0 -0
- {sqlutilpy-0.21.0/py → sqlutilpy-0.22.0/src}/sqlutilpy/__init__.py +0 -0
- {sqlutilpy-0.21.0/py → sqlutilpy-0.22.0/src}/sqlutilpy/sqlutil.py +0 -0
- {sqlutilpy-0.21.0/py → sqlutilpy-0.22.0/src}/sqlutilpy.egg-info/dependency_links.txt +0 -0
- {sqlutilpy-0.21.0/py → sqlutilpy-0.22.0/src}/sqlutilpy.egg-info/requires.txt +0 -0
- {sqlutilpy-0.21.0/py → sqlutilpy-0.22.0/src}/sqlutilpy.egg-info/top_level.txt +0 -0
- {sqlutilpy-0.21.0 → sqlutilpy-0.22.0}/tests/killer.py +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sqlutilpy
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.22.0
|
|
4
4
|
Summary: Database query code returning numpy arrays
|
|
5
|
-
|
|
6
|
-
Author: Sergey Koposov
|
|
7
|
-
Author-email: skoposov@ed.ac.uk
|
|
5
|
+
Author-email: "Sergey E. Koposov" <skoposov@ed.ac.uk>
|
|
8
6
|
License: BSD
|
|
7
|
+
Project-URL: Homepage, https://github.com/segasai/sqlutilpy
|
|
9
8
|
Keywords: numpy postgresql query sql sqlite array
|
|
10
9
|
Classifier: Development Status :: 3 - Alpha
|
|
11
|
-
Classifier: Topic :: Utilities
|
|
12
10
|
Classifier: License :: OSI Approved :: BSD License
|
|
11
|
+
Classifier: Topic :: Utilities
|
|
12
|
+
Requires-Python: >=3.6
|
|
13
13
|
Description-Content-Type: text/markdown
|
|
14
14
|
License-File: LICENSE.txt
|
|
15
15
|
Requires-Dist: numpy
|
|
@@ -24,7 +24,8 @@ Requires-Dist: numpydoc
|
|
|
24
24
|
# sqlutilpy
|
|
25
25
|
Python module to query SQL databases and return numpy arrays, upload
|
|
26
26
|
tables and run join queries involving local arrays and the tables in the DB.
|
|
27
|
-
|
|
27
|
+
This module is optimized to be able to deal efficiently with query results with millions of rows.
|
|
28
|
+
The module only works with PostgreSQL, SQLite and DuckDB databases.
|
|
28
29
|
|
|
29
30
|
The full documentation is available [here](http://sqlutilpy.readthedocs.io/en/latest/)
|
|
30
31
|
|
|
@@ -36,10 +37,11 @@ To install the package you just need to do pip install.
|
|
|
36
37
|
```
|
|
37
38
|
pip install sqlutilpy
|
|
38
39
|
```
|
|
39
|
-
##
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
## Authentication
|
|
41
|
+
|
|
42
|
+
Throughout this readme, I will assume that the .pgpass file ( https://www.postgresql.org/docs/11/libpq-pgpass.html )
|
|
43
|
+
has been created with your login/password details for Postgresql. If that is not the case, all of the
|
|
44
|
+
commands given below will also need user='....' and password='...' options
|
|
43
45
|
|
|
44
46
|
## Connection information
|
|
45
47
|
|
|
@@ -50,6 +52,8 @@ of the connection.
|
|
|
50
52
|
|
|
51
53
|
|
|
52
54
|
## Querying the database and retrieving the results
|
|
55
|
+
|
|
56
|
+
This command will run the query and put the columns into variables ra,dec
|
|
53
57
|
```python
|
|
54
58
|
import sqlutilpy
|
|
55
59
|
ra,dec = squtilpy.get('select ra,dec from mytable',
|
|
@@ -57,10 +61,11 @@ ra,dec = squtilpy.get('select ra,dec from mytable',
|
|
|
57
61
|
db='THE_NAME_OF_MY_DB')
|
|
58
62
|
```
|
|
59
63
|
|
|
60
|
-
By default sqlutilpy.get executes the
|
|
61
|
-
results.
|
|
64
|
+
By default sqlutilpy.get executes the query and returns the tuple with
|
|
65
|
+
results. You can return the results as dictionary using asDict option.
|
|
62
66
|
|
|
63
67
|
## Uploading your arrays as column in a table
|
|
68
|
+
|
|
64
69
|
```python
|
|
65
70
|
x = np.arange(10)
|
|
66
71
|
y = x**.5
|
|
@@ -76,20 +81,28 @@ you could upload the arrays in the DB and run a query, but local_join function d
|
|
|
76
81
|
|
|
77
82
|
```python
|
|
78
83
|
myid = np.arange(10)
|
|
79
|
-
y =
|
|
84
|
+
y = np.random.uniform(size=10)
|
|
85
|
+
|
|
80
86
|
R=sqlutilpy.local_join('''select * from mytmptable as m,
|
|
81
|
-
somebigtable as s where s.id=m.myid order by m.myid''',
|
|
87
|
+
somebigtable as s where s.id=m.myid order by m.myid''',
|
|
88
|
+
'mytmptable',(myid, y),('myid','ycol'))
|
|
82
89
|
```
|
|
83
|
-
It executes a query as if you arrays where in a mytmptable. ( behind the scenes
|
|
84
|
-
it uploads the data to the db and runs a query)
|
|
85
90
|
|
|
91
|
+
It executes a query as if you arrays were in mytmptable. (behind the scenes
|
|
92
|
+
it uploads the data to the db and runs a query)
|
|
86
93
|
|
|
87
94
|
## Keeping the connection open.
|
|
88
95
|
|
|
89
|
-
Often it
|
|
96
|
+
Often it is beneficial to preserve an open connection to the database. You can do that if you first
|
|
90
97
|
obtain the connection using sqlutilpy.getConnection() and then provide it directly
|
|
91
98
|
to sqlutil.get() and friends using conn=conn argument
|
|
99
|
+
```python
|
|
100
|
+
conn = sqlutilpy.getConnection(db='mydb', user='meuser', password='something', host='hostname')
|
|
101
|
+
R= sqlutilpy.get('select 1', conn=conn)
|
|
102
|
+
R1= sqlutilpy.get('select 1', conn=conn)
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
# How to cite the software
|
|
92
106
|
|
|
107
|
+
If you use this package, please cite it through zenodo https://doi.org/10.5281/zenodo.6867957
|
|
93
108
|
|
|
94
|
-
# How to cite it
|
|
95
|
-
If you use this, please cite it through zenodo https://doi.org/10.5281/zenodo.6867957
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
# sqlutilpy
|
|
7
7
|
Python module to query SQL databases and return numpy arrays, upload
|
|
8
8
|
tables and run join queries involving local arrays and the tables in the DB.
|
|
9
|
-
|
|
9
|
+
This module is optimized to be able to deal efficiently with query results with millions of rows.
|
|
10
|
+
The module only works with PostgreSQL, SQLite and DuckDB databases.
|
|
10
11
|
|
|
11
12
|
The full documentation is available [here](http://sqlutilpy.readthedocs.io/en/latest/)
|
|
12
13
|
|
|
@@ -18,10 +19,11 @@ To install the package you just need to do pip install.
|
|
|
18
19
|
```
|
|
19
20
|
pip install sqlutilpy
|
|
20
21
|
```
|
|
21
|
-
##
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
## Authentication
|
|
23
|
+
|
|
24
|
+
Throughout this readme, I will assume that the .pgpass file ( https://www.postgresql.org/docs/11/libpq-pgpass.html )
|
|
25
|
+
has been created with your login/password details for Postgresql. If that is not the case, all of the
|
|
26
|
+
commands given below will also need user='....' and password='...' options
|
|
25
27
|
|
|
26
28
|
## Connection information
|
|
27
29
|
|
|
@@ -32,6 +34,8 @@ of the connection.
|
|
|
32
34
|
|
|
33
35
|
|
|
34
36
|
## Querying the database and retrieving the results
|
|
37
|
+
|
|
38
|
+
This command will run the query and put the columns into variables ra,dec
|
|
35
39
|
```python
|
|
36
40
|
import sqlutilpy
|
|
37
41
|
ra,dec = squtilpy.get('select ra,dec from mytable',
|
|
@@ -39,10 +43,11 @@ ra,dec = squtilpy.get('select ra,dec from mytable',
|
|
|
39
43
|
db='THE_NAME_OF_MY_DB')
|
|
40
44
|
```
|
|
41
45
|
|
|
42
|
-
By default sqlutilpy.get executes the
|
|
43
|
-
results.
|
|
46
|
+
By default sqlutilpy.get executes the query and returns the tuple with
|
|
47
|
+
results. You can return the results as dictionary using asDict option.
|
|
44
48
|
|
|
45
49
|
## Uploading your arrays as column in a table
|
|
50
|
+
|
|
46
51
|
```python
|
|
47
52
|
x = np.arange(10)
|
|
48
53
|
y = x**.5
|
|
@@ -58,20 +63,28 @@ you could upload the arrays in the DB and run a query, but local_join function d
|
|
|
58
63
|
|
|
59
64
|
```python
|
|
60
65
|
myid = np.arange(10)
|
|
61
|
-
y =
|
|
66
|
+
y = np.random.uniform(size=10)
|
|
67
|
+
|
|
62
68
|
R=sqlutilpy.local_join('''select * from mytmptable as m,
|
|
63
|
-
somebigtable as s where s.id=m.myid order by m.myid''',
|
|
69
|
+
somebigtable as s where s.id=m.myid order by m.myid''',
|
|
70
|
+
'mytmptable',(myid, y),('myid','ycol'))
|
|
64
71
|
```
|
|
65
|
-
It executes a query as if you arrays where in a mytmptable. ( behind the scenes
|
|
66
|
-
it uploads the data to the db and runs a query)
|
|
67
72
|
|
|
73
|
+
It executes a query as if you arrays were in mytmptable. (behind the scenes
|
|
74
|
+
it uploads the data to the db and runs a query)
|
|
68
75
|
|
|
69
76
|
## Keeping the connection open.
|
|
70
77
|
|
|
71
|
-
Often it
|
|
78
|
+
Often it is beneficial to preserve an open connection to the database. You can do that if you first
|
|
72
79
|
obtain the connection using sqlutilpy.getConnection() and then provide it directly
|
|
73
80
|
to sqlutil.get() and friends using conn=conn argument
|
|
81
|
+
```python
|
|
82
|
+
conn = sqlutilpy.getConnection(db='mydb', user='meuser', password='something', host='hostname')
|
|
83
|
+
R= sqlutilpy.get('select 1', conn=conn)
|
|
84
|
+
R1= sqlutilpy.get('select 1', conn=conn)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
# How to cite the software
|
|
74
88
|
|
|
89
|
+
If you use this package, please cite it through zenodo https://doi.org/10.5281/zenodo.6867957
|
|
75
90
|
|
|
76
|
-
# How to cite it
|
|
77
|
-
If you use this, please cite it through zenodo https://doi.org/10.5281/zenodo.6867957
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "sqlutilpy"
|
|
3
|
+
dynamic = ["version"]
|
|
4
|
+
description = "Database query code returning numpy arrays"
|
|
5
|
+
authors = [
|
|
6
|
+
{name = "Sergey E. Koposov", email = "skoposov@ed.ac.uk"},
|
|
7
|
+
]
|
|
8
|
+
dependencies = [
|
|
9
|
+
"numpy",
|
|
10
|
+
"psycopg2-binary",
|
|
11
|
+
"numpydoc",
|
|
12
|
+
]
|
|
13
|
+
requires-python = ">=3.6"
|
|
14
|
+
readme = "README.md"
|
|
15
|
+
license = {text = "BSD"}
|
|
16
|
+
keywords = ["numpy postgresql query sql sqlite array"]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 3 - Alpha",
|
|
19
|
+
"License :: OSI Approved :: BSD License",
|
|
20
|
+
"Topic :: Utilities",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
[build-system]
|
|
24
|
+
requires = ["setuptools", "wheel", "setuptools-git-versioning"]
|
|
25
|
+
build-backend = "setuptools.build_meta"
|
|
26
|
+
|
|
27
|
+
[tool.setuptools-git-versioning]
|
|
28
|
+
enabled = true
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
Homepage = "https://github.com/segasai/sqlutilpy"
|
|
32
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '0.22.0'
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sqlutilpy
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.22.0
|
|
4
4
|
Summary: Database query code returning numpy arrays
|
|
5
|
-
|
|
6
|
-
Author: Sergey Koposov
|
|
7
|
-
Author-email: skoposov@ed.ac.uk
|
|
5
|
+
Author-email: "Sergey E. Koposov" <skoposov@ed.ac.uk>
|
|
8
6
|
License: BSD
|
|
7
|
+
Project-URL: Homepage, https://github.com/segasai/sqlutilpy
|
|
9
8
|
Keywords: numpy postgresql query sql sqlite array
|
|
10
9
|
Classifier: Development Status :: 3 - Alpha
|
|
11
|
-
Classifier: Topic :: Utilities
|
|
12
10
|
Classifier: License :: OSI Approved :: BSD License
|
|
11
|
+
Classifier: Topic :: Utilities
|
|
12
|
+
Requires-Python: >=3.6
|
|
13
13
|
Description-Content-Type: text/markdown
|
|
14
14
|
License-File: LICENSE.txt
|
|
15
15
|
Requires-Dist: numpy
|
|
@@ -24,7 +24,8 @@ Requires-Dist: numpydoc
|
|
|
24
24
|
# sqlutilpy
|
|
25
25
|
Python module to query SQL databases and return numpy arrays, upload
|
|
26
26
|
tables and run join queries involving local arrays and the tables in the DB.
|
|
27
|
-
|
|
27
|
+
This module is optimized to be able to deal efficiently with query results with millions of rows.
|
|
28
|
+
The module only works with PostgreSQL, SQLite and DuckDB databases.
|
|
28
29
|
|
|
29
30
|
The full documentation is available [here](http://sqlutilpy.readthedocs.io/en/latest/)
|
|
30
31
|
|
|
@@ -36,10 +37,11 @@ To install the package you just need to do pip install.
|
|
|
36
37
|
```
|
|
37
38
|
pip install sqlutilpy
|
|
38
39
|
```
|
|
39
|
-
##
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
## Authentication
|
|
41
|
+
|
|
42
|
+
Throughout this readme, I will assume that the .pgpass file ( https://www.postgresql.org/docs/11/libpq-pgpass.html )
|
|
43
|
+
has been created with your login/password details for Postgresql. If that is not the case, all of the
|
|
44
|
+
commands given below will also need user='....' and password='...' options
|
|
43
45
|
|
|
44
46
|
## Connection information
|
|
45
47
|
|
|
@@ -50,6 +52,8 @@ of the connection.
|
|
|
50
52
|
|
|
51
53
|
|
|
52
54
|
## Querying the database and retrieving the results
|
|
55
|
+
|
|
56
|
+
This command will run the query and put the columns into variables ra,dec
|
|
53
57
|
```python
|
|
54
58
|
import sqlutilpy
|
|
55
59
|
ra,dec = squtilpy.get('select ra,dec from mytable',
|
|
@@ -57,10 +61,11 @@ ra,dec = squtilpy.get('select ra,dec from mytable',
|
|
|
57
61
|
db='THE_NAME_OF_MY_DB')
|
|
58
62
|
```
|
|
59
63
|
|
|
60
|
-
By default sqlutilpy.get executes the
|
|
61
|
-
results.
|
|
64
|
+
By default sqlutilpy.get executes the query and returns the tuple with
|
|
65
|
+
results. You can return the results as dictionary using asDict option.
|
|
62
66
|
|
|
63
67
|
## Uploading your arrays as column in a table
|
|
68
|
+
|
|
64
69
|
```python
|
|
65
70
|
x = np.arange(10)
|
|
66
71
|
y = x**.5
|
|
@@ -76,20 +81,28 @@ you could upload the arrays in the DB and run a query, but local_join function d
|
|
|
76
81
|
|
|
77
82
|
```python
|
|
78
83
|
myid = np.arange(10)
|
|
79
|
-
y =
|
|
84
|
+
y = np.random.uniform(size=10)
|
|
85
|
+
|
|
80
86
|
R=sqlutilpy.local_join('''select * from mytmptable as m,
|
|
81
|
-
somebigtable as s where s.id=m.myid order by m.myid''',
|
|
87
|
+
somebigtable as s where s.id=m.myid order by m.myid''',
|
|
88
|
+
'mytmptable',(myid, y),('myid','ycol'))
|
|
82
89
|
```
|
|
83
|
-
It executes a query as if you arrays where in a mytmptable. ( behind the scenes
|
|
84
|
-
it uploads the data to the db and runs a query)
|
|
85
90
|
|
|
91
|
+
It executes a query as if you arrays were in mytmptable. (behind the scenes
|
|
92
|
+
it uploads the data to the db and runs a query)
|
|
86
93
|
|
|
87
94
|
## Keeping the connection open.
|
|
88
95
|
|
|
89
|
-
Often it
|
|
96
|
+
Often it is beneficial to preserve an open connection to the database. You can do that if you first
|
|
90
97
|
obtain the connection using sqlutilpy.getConnection() and then provide it directly
|
|
91
98
|
to sqlutil.get() and friends using conn=conn argument
|
|
99
|
+
```python
|
|
100
|
+
conn = sqlutilpy.getConnection(db='mydb', user='meuser', password='something', host='hostname')
|
|
101
|
+
R= sqlutilpy.get('select 1', conn=conn)
|
|
102
|
+
R1= sqlutilpy.get('select 1', conn=conn)
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
# How to cite the software
|
|
92
106
|
|
|
107
|
+
If you use this package, please cite it through zenodo https://doi.org/10.5281/zenodo.6867957
|
|
93
108
|
|
|
94
|
-
# How to cite it
|
|
95
|
-
If you use this, please cite it through zenodo https://doi.org/10.5281/zenodo.6867957
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
LICENSE.txt
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
README.md
|
|
4
|
+
pyproject.toml
|
|
5
|
+
src/sqlutilpy/__init__.py
|
|
6
|
+
src/sqlutilpy/sqlutil.py
|
|
7
|
+
src/sqlutilpy/version.py
|
|
8
|
+
src/sqlutilpy.egg-info/PKG-INFO
|
|
9
|
+
src/sqlutilpy.egg-info/SOURCES.txt
|
|
10
|
+
src/sqlutilpy.egg-info/dependency_links.txt
|
|
11
|
+
src/sqlutilpy.egg-info/requires.txt
|
|
12
|
+
src/sqlutilpy.egg-info/top_level.txt
|
|
13
|
+
tests/killer.py
|
|
14
|
+
tests/test_pg.py
|
|
15
|
+
tests/test_sqlite.py
|