sqlalchemy-multiple-db 1.7.0__tar.gz → 2.0.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.
- sqlalchemy-multiple-db-2.0.0/PKG-INFO +77 -0
- {sqlalchemy-multiple-db-1.7.0 → sqlalchemy-multiple-db-2.0.0}/setup.py +3 -1
- {sqlalchemy-multiple-db-1.7.0 → sqlalchemy-multiple-db-2.0.0}/sqlalchemy_multiple_db/helper.py +8 -6
- {sqlalchemy-multiple-db-1.7.0 → sqlalchemy-multiple-db-2.0.0}/sqlalchemy_multiple_db/version.py +1 -1
- sqlalchemy-multiple-db-2.0.0/sqlalchemy_multiple_db.egg-info/PKG-INFO +77 -0
- sqlalchemy-multiple-db-2.0.0/sqlalchemy_multiple_db.egg-info/requires.txt +1 -0
- sqlalchemy-multiple-db-1.7.0/PKG-INFO +0 -74
- sqlalchemy-multiple-db-1.7.0/sqlalchemy_multiple_db.egg-info/PKG-INFO +0 -74
- sqlalchemy-multiple-db-1.7.0/sqlalchemy_multiple_db.egg-info/requires.txt +0 -1
- {sqlalchemy-multiple-db-1.7.0 → sqlalchemy-multiple-db-2.0.0}/LICENSE +0 -0
- {sqlalchemy-multiple-db-1.7.0 → sqlalchemy-multiple-db-2.0.0}/MANIFEST.in +0 -0
- {sqlalchemy-multiple-db-1.7.0 → sqlalchemy-multiple-db-2.0.0}/README.md +0 -0
- {sqlalchemy-multiple-db-1.7.0 → sqlalchemy-multiple-db-2.0.0}/pyproject.toml +0 -0
- {sqlalchemy-multiple-db-1.7.0 → sqlalchemy-multiple-db-2.0.0}/setup.cfg +0 -0
- {sqlalchemy-multiple-db-1.7.0 → sqlalchemy-multiple-db-2.0.0}/sqlalchemy_multiple_db/__init__.py +0 -0
- {sqlalchemy-multiple-db-1.7.0 → sqlalchemy-multiple-db-2.0.0}/sqlalchemy_multiple_db.egg-info/SOURCES.txt +0 -0
- {sqlalchemy-multiple-db-1.7.0 → sqlalchemy-multiple-db-2.0.0}/sqlalchemy_multiple_db.egg-info/dependency_links.txt +0 -0
- {sqlalchemy-multiple-db-1.7.0 → sqlalchemy-multiple-db-2.0.0}/sqlalchemy_multiple_db.egg-info/not-zip-safe +0 -0
- {sqlalchemy-multiple-db-1.7.0 → sqlalchemy-multiple-db-2.0.0}/sqlalchemy_multiple_db.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: sqlalchemy-multiple-db
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: Helper for easily connect to multiple databases.
|
|
5
|
+
Home-page: https://github.com/bigbag/sqlalchemy-multiple-db
|
|
6
|
+
Download-URL: https://pypi.python.org/pypi/sqlalchemy-multiple-db
|
|
7
|
+
Author: Pavel Liashkov
|
|
8
|
+
Author-email: pavel.liashkov@protonmail.com
|
|
9
|
+
Maintainer: Pavel Liashkov
|
|
10
|
+
Maintainer-email: pavel.liashkov@protonmail.com
|
|
11
|
+
License: Apache License, Version 2.0
|
|
12
|
+
Platform: POSIX
|
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Operating System :: POSIX
|
|
21
|
+
Classifier: Topic :: Software Development
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
23
|
+
Classifier: Environment :: Console
|
|
24
|
+
Classifier: Intended Audience :: Developers
|
|
25
|
+
Requires-Python: >=3.7
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
|
|
29
|
+
# sqlalchemy-multiple-db
|
|
30
|
+
|
|
31
|
+
[](https://github.com/bigbag/sqlalchemy-multiple-db/actions?query=workflow%3ACI)
|
|
32
|
+
[](https://codecov.io/gh/bigbag/sqlalchemy-multiple-db)
|
|
33
|
+
[](https://pypi.python.org/pypi/sqlalchemy-multiple-db)
|
|
34
|
+
[](https://pypistats.org/packages/sqlalchemy-multiple-db)
|
|
35
|
+
[](https://github.com/bigbag/sqlalchemy-multiple-db)
|
|
36
|
+
[](https://github.com/bigbag/sqlalchemy-multiple-db/blob/master/LICENSE)
|
|
37
|
+
|
|
38
|
+
**sqlalchemy-multiple-db** helper for easily connect to multiple databases.
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
## Installation
|
|
42
|
+
|
|
43
|
+
sqlalchemy-multiple-db is available on PyPI.
|
|
44
|
+
Use pip to install:
|
|
45
|
+
|
|
46
|
+
$ pip install sqlalchemy-multiple-db
|
|
47
|
+
|
|
48
|
+
## Basic Usage
|
|
49
|
+
```py
|
|
50
|
+
from sqlalchemy_multiple_db import DBConfig, db
|
|
51
|
+
|
|
52
|
+
db.setup({"test1": DBConfig(dsn="sqlite://"), "test2": DBConfig(dsn="sqlite://")})
|
|
53
|
+
|
|
54
|
+
with db.session_scope("test1") as session:
|
|
55
|
+
assert session.execute("select 1;")
|
|
56
|
+
|
|
57
|
+
with db.session_scope("test2") as session:
|
|
58
|
+
assert session.execute("select 1;")
|
|
59
|
+
|
|
60
|
+
db.shutdown()
|
|
61
|
+
|
|
62
|
+
db.setup(DBConfig(dsn="sqlite://"))
|
|
63
|
+
|
|
64
|
+
with db.session_scope() as session:
|
|
65
|
+
assert session.execute("select 1;")
|
|
66
|
+
|
|
67
|
+
db.shutdown()
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## License
|
|
72
|
+
|
|
73
|
+
sqlalchemy-multiple-db is developed and distributed under the Apache 2.0 license.
|
|
74
|
+
|
|
75
|
+
## Reporting a Security Vulnerability
|
|
76
|
+
|
|
77
|
+
See our [security policy](https://github.com/bigbag/sqlalchemy-multiple-db/security/policy).
|
|
@@ -18,6 +18,8 @@ CLASSIFIERS = [
|
|
|
18
18
|
"Programming Language :: Python :: 3.7",
|
|
19
19
|
"Programming Language :: Python :: 3.8",
|
|
20
20
|
"Programming Language :: Python :: 3.9",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
21
23
|
"Operating System :: POSIX",
|
|
22
24
|
"Topic :: Software Development",
|
|
23
25
|
"Topic :: Software Development :: Libraries",
|
|
@@ -42,7 +44,7 @@ setup(
|
|
|
42
44
|
platforms=["POSIX"],
|
|
43
45
|
classifiers=CLASSIFIERS,
|
|
44
46
|
python_requires=">=3.7",
|
|
45
|
-
install_requires=["SQLAlchemy
|
|
47
|
+
install_requires=["SQLAlchemy>=1.4,<2.1"],
|
|
46
48
|
packages=find_packages(),
|
|
47
49
|
include_package_data=True,
|
|
48
50
|
zip_safe=False,
|
{sqlalchemy-multiple-db-1.7.0 → sqlalchemy-multiple-db-2.0.0}/sqlalchemy_multiple_db/helper.py
RENAMED
|
@@ -6,6 +6,7 @@ from typing import Any, Dict, Optional, Tuple, Union
|
|
|
6
6
|
|
|
7
7
|
from sqlalchemy import create_engine
|
|
8
8
|
from sqlalchemy.orm import Session, scoped_session, sessionmaker
|
|
9
|
+
from sqlalchemy.sql import text
|
|
9
10
|
|
|
10
11
|
logger = logging.getLogger(__name__)
|
|
11
12
|
|
|
@@ -51,12 +52,13 @@ class DBHelper:
|
|
|
51
52
|
raise exc
|
|
52
53
|
|
|
53
54
|
def create_scoped_session(self, config: DBConfig) -> Session:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
engine_options = config.engine_options or {}
|
|
56
|
+
session_options = config.session_options or {}
|
|
57
|
+
|
|
58
|
+
session = scoped_session(
|
|
59
|
+
sessionmaker(bind=create_engine(config.dsn, **engine_options), **session_options)
|
|
58
60
|
)
|
|
59
|
-
return session
|
|
61
|
+
return session # type: ignore
|
|
60
62
|
|
|
61
63
|
def setup(self, config: Union[DBConfig, Dict[str, DBConfig]]):
|
|
62
64
|
if isinstance(config, DBConfig):
|
|
@@ -87,7 +89,7 @@ class DBHelper:
|
|
|
87
89
|
for db_name, session in self.sessions.items():
|
|
88
90
|
status = True
|
|
89
91
|
try:
|
|
90
|
-
session.execute("select 1;")
|
|
92
|
+
session.execute(text("select 1;"))
|
|
91
93
|
except Exception as e:
|
|
92
94
|
status &= False
|
|
93
95
|
full_status &= False
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: sqlalchemy-multiple-db
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: Helper for easily connect to multiple databases.
|
|
5
|
+
Home-page: https://github.com/bigbag/sqlalchemy-multiple-db
|
|
6
|
+
Download-URL: https://pypi.python.org/pypi/sqlalchemy-multiple-db
|
|
7
|
+
Author: Pavel Liashkov
|
|
8
|
+
Author-email: pavel.liashkov@protonmail.com
|
|
9
|
+
Maintainer: Pavel Liashkov
|
|
10
|
+
Maintainer-email: pavel.liashkov@protonmail.com
|
|
11
|
+
License: Apache License, Version 2.0
|
|
12
|
+
Platform: POSIX
|
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Operating System :: POSIX
|
|
21
|
+
Classifier: Topic :: Software Development
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
23
|
+
Classifier: Environment :: Console
|
|
24
|
+
Classifier: Intended Audience :: Developers
|
|
25
|
+
Requires-Python: >=3.7
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
|
|
29
|
+
# sqlalchemy-multiple-db
|
|
30
|
+
|
|
31
|
+
[](https://github.com/bigbag/sqlalchemy-multiple-db/actions?query=workflow%3ACI)
|
|
32
|
+
[](https://codecov.io/gh/bigbag/sqlalchemy-multiple-db)
|
|
33
|
+
[](https://pypi.python.org/pypi/sqlalchemy-multiple-db)
|
|
34
|
+
[](https://pypistats.org/packages/sqlalchemy-multiple-db)
|
|
35
|
+
[](https://github.com/bigbag/sqlalchemy-multiple-db)
|
|
36
|
+
[](https://github.com/bigbag/sqlalchemy-multiple-db/blob/master/LICENSE)
|
|
37
|
+
|
|
38
|
+
**sqlalchemy-multiple-db** helper for easily connect to multiple databases.
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
## Installation
|
|
42
|
+
|
|
43
|
+
sqlalchemy-multiple-db is available on PyPI.
|
|
44
|
+
Use pip to install:
|
|
45
|
+
|
|
46
|
+
$ pip install sqlalchemy-multiple-db
|
|
47
|
+
|
|
48
|
+
## Basic Usage
|
|
49
|
+
```py
|
|
50
|
+
from sqlalchemy_multiple_db import DBConfig, db
|
|
51
|
+
|
|
52
|
+
db.setup({"test1": DBConfig(dsn="sqlite://"), "test2": DBConfig(dsn="sqlite://")})
|
|
53
|
+
|
|
54
|
+
with db.session_scope("test1") as session:
|
|
55
|
+
assert session.execute("select 1;")
|
|
56
|
+
|
|
57
|
+
with db.session_scope("test2") as session:
|
|
58
|
+
assert session.execute("select 1;")
|
|
59
|
+
|
|
60
|
+
db.shutdown()
|
|
61
|
+
|
|
62
|
+
db.setup(DBConfig(dsn="sqlite://"))
|
|
63
|
+
|
|
64
|
+
with db.session_scope() as session:
|
|
65
|
+
assert session.execute("select 1;")
|
|
66
|
+
|
|
67
|
+
db.shutdown()
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## License
|
|
72
|
+
|
|
73
|
+
sqlalchemy-multiple-db is developed and distributed under the Apache 2.0 license.
|
|
74
|
+
|
|
75
|
+
## Reporting a Security Vulnerability
|
|
76
|
+
|
|
77
|
+
See our [security policy](https://github.com/bigbag/sqlalchemy-multiple-db/security/policy).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
SQLAlchemy<2.1,>=1.4
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: sqlalchemy-multiple-db
|
|
3
|
-
Version: 1.7.0
|
|
4
|
-
Summary: Helper for easily connect to multiple databases.
|
|
5
|
-
Home-page: https://github.com/bigbag/sqlalchemy-multiple-db
|
|
6
|
-
Author: Pavel Liashkov
|
|
7
|
-
Author-email: pavel.liashkov@protonmail.com
|
|
8
|
-
Maintainer: Pavel Liashkov
|
|
9
|
-
Maintainer-email: pavel.liashkov@protonmail.com
|
|
10
|
-
License: Apache License, Version 2.0
|
|
11
|
-
Download-URL: https://pypi.python.org/pypi/sqlalchemy-multiple-db
|
|
12
|
-
Description: # sqlalchemy-multiple-db
|
|
13
|
-
|
|
14
|
-
[](https://github.com/bigbag/sqlalchemy-multiple-db/actions?query=workflow%3ACI)
|
|
15
|
-
[](https://codecov.io/gh/bigbag/sqlalchemy-multiple-db)
|
|
16
|
-
[](https://pypi.python.org/pypi/sqlalchemy-multiple-db)
|
|
17
|
-
[](https://pypistats.org/packages/sqlalchemy-multiple-db)
|
|
18
|
-
[](https://github.com/bigbag/sqlalchemy-multiple-db)
|
|
19
|
-
[](https://github.com/bigbag/sqlalchemy-multiple-db/blob/master/LICENSE)
|
|
20
|
-
|
|
21
|
-
**sqlalchemy-multiple-db** helper for easily connect to multiple databases.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
## Installation
|
|
25
|
-
|
|
26
|
-
sqlalchemy-multiple-db is available on PyPI.
|
|
27
|
-
Use pip to install:
|
|
28
|
-
|
|
29
|
-
$ pip install sqlalchemy-multiple-db
|
|
30
|
-
|
|
31
|
-
## Basic Usage
|
|
32
|
-
```py
|
|
33
|
-
from sqlalchemy_multiple_db import DBConfig, db
|
|
34
|
-
|
|
35
|
-
db.setup({"test1": DBConfig(dsn="sqlite://"), "test2": DBConfig(dsn="sqlite://")})
|
|
36
|
-
|
|
37
|
-
with db.session_scope("test1") as session:
|
|
38
|
-
assert session.execute("select 1;")
|
|
39
|
-
|
|
40
|
-
with db.session_scope("test2") as session:
|
|
41
|
-
assert session.execute("select 1;")
|
|
42
|
-
|
|
43
|
-
db.shutdown()
|
|
44
|
-
|
|
45
|
-
db.setup(DBConfig(dsn="sqlite://"))
|
|
46
|
-
|
|
47
|
-
with db.session_scope() as session:
|
|
48
|
-
assert session.execute("select 1;")
|
|
49
|
-
|
|
50
|
-
db.shutdown()
|
|
51
|
-
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## License
|
|
55
|
-
|
|
56
|
-
sqlalchemy-multiple-db is developed and distributed under the Apache 2.0 license.
|
|
57
|
-
|
|
58
|
-
## Reporting a Security Vulnerability
|
|
59
|
-
|
|
60
|
-
See our [security policy](https://github.com/bigbag/sqlalchemy-multiple-db/security/policy).
|
|
61
|
-
|
|
62
|
-
Platform: POSIX
|
|
63
|
-
Classifier: Development Status :: 5 - Production/Stable
|
|
64
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
|
65
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
66
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
67
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
68
|
-
Classifier: Operating System :: POSIX
|
|
69
|
-
Classifier: Topic :: Software Development
|
|
70
|
-
Classifier: Topic :: Software Development :: Libraries
|
|
71
|
-
Classifier: Environment :: Console
|
|
72
|
-
Classifier: Intended Audience :: Developers
|
|
73
|
-
Requires-Python: >=3.7
|
|
74
|
-
Description-Content-Type: text/markdown
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: sqlalchemy-multiple-db
|
|
3
|
-
Version: 1.7.0
|
|
4
|
-
Summary: Helper for easily connect to multiple databases.
|
|
5
|
-
Home-page: https://github.com/bigbag/sqlalchemy-multiple-db
|
|
6
|
-
Author: Pavel Liashkov
|
|
7
|
-
Author-email: pavel.liashkov@protonmail.com
|
|
8
|
-
Maintainer: Pavel Liashkov
|
|
9
|
-
Maintainer-email: pavel.liashkov@protonmail.com
|
|
10
|
-
License: Apache License, Version 2.0
|
|
11
|
-
Download-URL: https://pypi.python.org/pypi/sqlalchemy-multiple-db
|
|
12
|
-
Description: # sqlalchemy-multiple-db
|
|
13
|
-
|
|
14
|
-
[](https://github.com/bigbag/sqlalchemy-multiple-db/actions?query=workflow%3ACI)
|
|
15
|
-
[](https://codecov.io/gh/bigbag/sqlalchemy-multiple-db)
|
|
16
|
-
[](https://pypi.python.org/pypi/sqlalchemy-multiple-db)
|
|
17
|
-
[](https://pypistats.org/packages/sqlalchemy-multiple-db)
|
|
18
|
-
[](https://github.com/bigbag/sqlalchemy-multiple-db)
|
|
19
|
-
[](https://github.com/bigbag/sqlalchemy-multiple-db/blob/master/LICENSE)
|
|
20
|
-
|
|
21
|
-
**sqlalchemy-multiple-db** helper for easily connect to multiple databases.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
## Installation
|
|
25
|
-
|
|
26
|
-
sqlalchemy-multiple-db is available on PyPI.
|
|
27
|
-
Use pip to install:
|
|
28
|
-
|
|
29
|
-
$ pip install sqlalchemy-multiple-db
|
|
30
|
-
|
|
31
|
-
## Basic Usage
|
|
32
|
-
```py
|
|
33
|
-
from sqlalchemy_multiple_db import DBConfig, db
|
|
34
|
-
|
|
35
|
-
db.setup({"test1": DBConfig(dsn="sqlite://"), "test2": DBConfig(dsn="sqlite://")})
|
|
36
|
-
|
|
37
|
-
with db.session_scope("test1") as session:
|
|
38
|
-
assert session.execute("select 1;")
|
|
39
|
-
|
|
40
|
-
with db.session_scope("test2") as session:
|
|
41
|
-
assert session.execute("select 1;")
|
|
42
|
-
|
|
43
|
-
db.shutdown()
|
|
44
|
-
|
|
45
|
-
db.setup(DBConfig(dsn="sqlite://"))
|
|
46
|
-
|
|
47
|
-
with db.session_scope() as session:
|
|
48
|
-
assert session.execute("select 1;")
|
|
49
|
-
|
|
50
|
-
db.shutdown()
|
|
51
|
-
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## License
|
|
55
|
-
|
|
56
|
-
sqlalchemy-multiple-db is developed and distributed under the Apache 2.0 license.
|
|
57
|
-
|
|
58
|
-
## Reporting a Security Vulnerability
|
|
59
|
-
|
|
60
|
-
See our [security policy](https://github.com/bigbag/sqlalchemy-multiple-db/security/policy).
|
|
61
|
-
|
|
62
|
-
Platform: POSIX
|
|
63
|
-
Classifier: Development Status :: 5 - Production/Stable
|
|
64
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
|
65
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
66
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
67
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
68
|
-
Classifier: Operating System :: POSIX
|
|
69
|
-
Classifier: Topic :: Software Development
|
|
70
|
-
Classifier: Topic :: Software Development :: Libraries
|
|
71
|
-
Classifier: Environment :: Console
|
|
72
|
-
Classifier: Intended Audience :: Developers
|
|
73
|
-
Requires-Python: >=3.7
|
|
74
|
-
Description-Content-Type: text/markdown
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
SQLAlchemy==1.4.22
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sqlalchemy-multiple-db-1.7.0 → sqlalchemy-multiple-db-2.0.0}/sqlalchemy_multiple_db/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|