python-datastore-sqlalchemy 0.0.2__py3-none-any.whl → 0.0.4__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.
- python_datastore_sqlalchemy-0.0.4.dist-info/METADATA +98 -0
- python_datastore_sqlalchemy-0.0.4.dist-info/RECORD +12 -0
- {python_datastore_sqlalchemy-0.0.2.dist-info → python_datastore_sqlalchemy-0.0.4.dist-info}/WHEEL +1 -1
- sqlalchemy_datastore/__init__.py +1 -1
- sqlalchemy_datastore/base.py +9 -2
- python_datastore_sqlalchemy-0.0.2.dist-info/METADATA +0 -76
- python_datastore_sqlalchemy-0.0.2.dist-info/RECORD +0 -12
- {python_datastore_sqlalchemy-0.0.2.dist-info → python_datastore_sqlalchemy-0.0.4.dist-info}/entry_points.txt +0 -0
- {python_datastore_sqlalchemy-0.0.2.dist-info → python_datastore_sqlalchemy-0.0.4.dist-info}/licenses/LICENSE +0 -0
- {python_datastore_sqlalchemy-0.0.2.dist-info → python_datastore_sqlalchemy-0.0.4.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: python-datastore-sqlalchemy
|
|
3
|
+
Version: 0.0.4
|
|
4
|
+
Summary: SQLAlchemy dialect for google cloud datastore
|
|
5
|
+
Author-email: "HY Chang(splasky)" <hychang.1997.tw@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Documentation, https://github.com/splasky/python-datastore-sqlalchemy/wiki
|
|
8
|
+
Project-URL: Source, https://github.com/splasky/python-datastore-sqlalchemy
|
|
9
|
+
Project-URL: Tracker, https://github.com/splasky/python-datastore-sqlalchemy/issues
|
|
10
|
+
Keywords: SQLAlchemy,GCP,Datastore
|
|
11
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
19
|
+
Classifier: Topic :: Database :: Front-Ends
|
|
20
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
21
|
+
Requires-Python: >=3.11
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: sqlalchemy<3.0.0,>=1.4.16
|
|
25
|
+
Requires-Dist: google-cloud-datastore>=2.21.0
|
|
26
|
+
Requires-Dist: google-cloud-firestore>=2.21.0
|
|
27
|
+
Requires-Dist: google-cloud-bigquery>=3.35.0
|
|
28
|
+
Requires-Dist: google-auth>=2.40.0
|
|
29
|
+
Requires-Dist: sqlglot>=28.0.0
|
|
30
|
+
Requires-Dist: pandas>=2.0.0
|
|
31
|
+
Requires-Dist: requests
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+
SQLAlchemy dialect for Google Cloud Datastore in Firestore mode
|
|
35
|
+
========================
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
Install from PyPI:
|
|
40
|
+
```bash
|
|
41
|
+
pip install python-datastore-sqlalchemy
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Install from a local checkout:
|
|
45
|
+
```bash
|
|
46
|
+
uv pip install -e .
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Runtime dependencies are declared in `pyproject.toml`. `requirements.txt` is not used by this project.
|
|
50
|
+
|
|
51
|
+
## Usage
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
from sqlalchemy import create_engine, text
|
|
55
|
+
|
|
56
|
+
engine = create_engine(
|
|
57
|
+
"datastore://my-project/?database=my-db",
|
|
58
|
+
credentials="path/to/credentials.json",
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
with engine.connect() as conn:
|
|
62
|
+
result = conn.execute(text("SELECT * FROM test_table"))
|
|
63
|
+
print(result.fetchall())
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Preview
|
|
67
|
+
|
|
68
|
+
<img src="assets/pie.png">
|
|
69
|
+
|
|
70
|
+
> [!WARNING]
|
|
71
|
+
> Please note: Not all GQL and SQL syntax has been fully tested. Should you encounter any bugs, please post the relevant query and open an issue on GitHub.
|
|
72
|
+
|
|
73
|
+
## How to contribute
|
|
74
|
+
|
|
75
|
+
Feel free to open issues and pull requests on GitHub.
|
|
76
|
+
|
|
77
|
+
## Development
|
|
78
|
+
|
|
79
|
+
This project supports Python 3.11 and newer. It uses a uv-managed virtual environment by default. The lockfile is tracked so local development and CI use the same dependency resolution.
|
|
80
|
+
|
|
81
|
+
Install the development environment:
|
|
82
|
+
```bash
|
|
83
|
+
uv sync --locked
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Run the test suite:
|
|
87
|
+
```bash
|
|
88
|
+
uv run pytest
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The Datastore-backed tests require the Google Cloud SDK with the `beta` and `cloud-datastore-emulator` components installed. If `gcloud` is not on `PATH`, point the test fixture at it explicitly:
|
|
92
|
+
```bash
|
|
93
|
+
GCLOUD_PATH=/path/to/google-cloud-sdk/bin/gcloud uv run pytest
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Development Notes
|
|
97
|
+
|
|
98
|
+
- [Develop a SQLAlchemy and its dialects](https://hackmd.io/lsBW5GCVR82SORyWZ1cssA?view)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
python_datastore_sqlalchemy-0.0.4.dist-info/licenses/LICENSE,sha256=vcsHP9P3NtGefy7ojTRCgi3w0QqF_igVlmFP5A47YVA,1093
|
|
2
|
+
sqlalchemy_datastore/__init__.py,sha256=8-KfLPXIwY4T4zjy9OvGRterN5imPk9om7MaWi5Nf_U,1239
|
|
3
|
+
sqlalchemy_datastore/_helpers.py,sha256=bRvNeMz6QgJMW1M5K-dXksdnURYBZE-NIzt3tue92rg,4854
|
|
4
|
+
sqlalchemy_datastore/_types.py,sha256=zs-Gr1XPP-UnppzsuWHEmD-wshkuosXM7yGeUIt-VVY,5092
|
|
5
|
+
sqlalchemy_datastore/base.py,sha256=jvhe2WYFIRwtYpKlEaTaKH3R7Tf_hwXgA5s7zO8orL0,9560
|
|
6
|
+
sqlalchemy_datastore/datastore_dbapi.py,sha256=xJVZR0Ymzj1XjB6-UeWQRHRLLYLzlOrjaYOEv3-13lY,94404
|
|
7
|
+
sqlalchemy_datastore/parse_url.py,sha256=sTeNqBm-V4Dec97R4K264qvG05aUXG7iNFyKNCNkPJ8,10058
|
|
8
|
+
python_datastore_sqlalchemy-0.0.4.dist-info/METADATA,sha256=OLfx47cI2pZzRbAyvUIPU5uV148TBA4ixHXurjgTRFM,3029
|
|
9
|
+
python_datastore_sqlalchemy-0.0.4.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
10
|
+
python_datastore_sqlalchemy-0.0.4.dist-info/entry_points.txt,sha256=h54O-P7HFeCKpoeQ-XSSyP_GVZ1FRAY3gFCS5lkDBIs,77
|
|
11
|
+
python_datastore_sqlalchemy-0.0.4.dist-info/top_level.txt,sha256=SE6uZfiwIQaJ1RDBfMm37dm7ZIZoqDcwQ1fDm32x0Rg,21
|
|
12
|
+
python_datastore_sqlalchemy-0.0.4.dist-info/RECORD,,
|
sqlalchemy_datastore/__init__.py
CHANGED
sqlalchemy_datastore/base.py
CHANGED
|
@@ -20,6 +20,7 @@ import logging
|
|
|
20
20
|
from typing import Any, List, Optional
|
|
21
21
|
|
|
22
22
|
from google.cloud import firestore_admin_v1
|
|
23
|
+
from google.cloud.datastore.query import PropertyFilter
|
|
23
24
|
from google.oauth2 import service_account
|
|
24
25
|
from sqlalchemy import exc
|
|
25
26
|
from sqlalchemy.engine import Connection, default
|
|
@@ -54,6 +55,7 @@ class CloudDatastoreDialect(default.DefaultDialect):
|
|
|
54
55
|
supports_unicode_binds = True
|
|
55
56
|
returns_unicode_strings = True
|
|
56
57
|
description_encoding = None
|
|
58
|
+
supports_statement_cache = False
|
|
57
59
|
|
|
58
60
|
# JSON support - required for SQLAlchemy JSON type
|
|
59
61
|
_json_serializer = None
|
|
@@ -88,10 +90,15 @@ class CloudDatastoreDialect(default.DefaultDialect):
|
|
|
88
90
|
self._client = None
|
|
89
91
|
|
|
90
92
|
@classmethod
|
|
91
|
-
def
|
|
93
|
+
def import_dbapi(cls):
|
|
92
94
|
"""Return the DBAPI 2.0 driver."""
|
|
93
95
|
return datastore_dbapi
|
|
94
96
|
|
|
97
|
+
@classmethod
|
|
98
|
+
def dbapi(cls):
|
|
99
|
+
"""Return the DBAPI 2.0 driver."""
|
|
100
|
+
return cls.import_dbapi()
|
|
101
|
+
|
|
95
102
|
def do_ping(self, dbapi_connection):
|
|
96
103
|
"""Performs a simple operation to check if the connection is still alive."""
|
|
97
104
|
try:
|
|
@@ -212,7 +219,7 @@ class CloudDatastoreDialect(default.DefaultDialect):
|
|
|
212
219
|
"""Retrieve column information from the database."""
|
|
213
220
|
client = self._client
|
|
214
221
|
query = client.query(kind="__Stat_PropertyType_PropertyName_Kind__")
|
|
215
|
-
query.add_filter("kind_name", "=", table_name)
|
|
222
|
+
query.add_filter(filter=PropertyFilter("kind_name", "=", table_name))
|
|
216
223
|
properties = list(query.fetch())
|
|
217
224
|
|
|
218
225
|
return [
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: python-datastore-sqlalchemy
|
|
3
|
-
Version: 0.0.2
|
|
4
|
-
Summary: SQLAlchemy dialect for google cloud datastore
|
|
5
|
-
Home-page: https://github.com/splasky/python-datastore-sqlalchemy
|
|
6
|
-
Author: HY Chang(splasky)
|
|
7
|
-
Author-email: hychang.1997.tw@gmail.com
|
|
8
|
-
License: MIT
|
|
9
|
-
Project-URL: Documentation, https://github.com/splasky/python-datastore-sqlalchemy/wiki
|
|
10
|
-
Project-URL: Source, https://github.com/splasky/python-datastore-sqlalchemy
|
|
11
|
-
Project-URL: Tracker, https://github.com/splasky/python-datastore-sqlalchemy/issues
|
|
12
|
-
Keywords: SQLAlchemy GCP Datastore
|
|
13
|
-
Classifier: Development Status :: 2 - Pre-Alpha
|
|
14
|
-
Classifier: Intended Audience :: Developers
|
|
15
|
-
Classifier: Programming Language :: Python
|
|
16
|
-
Classifier: Programming Language :: Python :: 3
|
|
17
|
-
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
18
|
-
Classifier: Topic :: Database :: Front-Ends
|
|
19
|
-
Classifier: Operating System :: POSIX :: Linux
|
|
20
|
-
Requires-Python: >=3.9
|
|
21
|
-
Description-Content-Type: text/markdown
|
|
22
|
-
License-File: LICENSE
|
|
23
|
-
Requires-Dist: sqlalchemy<3.0.0,>=1.4.16
|
|
24
|
-
Requires-Dist: google-cloud-datastore>=2.21.0
|
|
25
|
-
Requires-Dist: google-cloud-firestore>=2.21.0
|
|
26
|
-
Requires-Dist: google-cloud-bigquery>=3.35.0
|
|
27
|
-
Requires-Dist: google-auth>=2.40.0
|
|
28
|
-
Requires-Dist: sqlglot>=28.0.0
|
|
29
|
-
Requires-Dist: pandas>=2.0.0
|
|
30
|
-
Requires-Dist: requests
|
|
31
|
-
Dynamic: author
|
|
32
|
-
Dynamic: author-email
|
|
33
|
-
Dynamic: classifier
|
|
34
|
-
Dynamic: description
|
|
35
|
-
Dynamic: description-content-type
|
|
36
|
-
Dynamic: home-page
|
|
37
|
-
Dynamic: keywords
|
|
38
|
-
Dynamic: license
|
|
39
|
-
Dynamic: license-file
|
|
40
|
-
Dynamic: project-url
|
|
41
|
-
Dynamic: requires-dist
|
|
42
|
-
Dynamic: requires-python
|
|
43
|
-
Dynamic: summary
|
|
44
|
-
|
|
45
|
-
SQLAlchemy dialect for google cloud datastore(firestore mode)
|
|
46
|
-
========================
|
|
47
|
-
How to install
|
|
48
|
-
```
|
|
49
|
-
python3 setup.py install
|
|
50
|
-
```
|
|
51
|
-
or
|
|
52
|
-
```
|
|
53
|
-
pip install python-datastore-sqlalchemy
|
|
54
|
-
```
|
|
55
|
-
How to use
|
|
56
|
-
```python
|
|
57
|
-
from sqlalchemy import *
|
|
58
|
-
from sqlalchemy.engine import create_engine
|
|
59
|
-
from sqlalchemy.schema import *
|
|
60
|
-
engine = create_engine("datastore://my-project/?database=my-db", credentials='path/to/credentials.json')
|
|
61
|
-
conn = engine.connect()
|
|
62
|
-
result = conn.execute("SELECT * fro" test_table")
|
|
63
|
-
print(result.fetchall())
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
## Preview
|
|
67
|
-
<img src="assets/pie.png">
|
|
68
|
-
|
|
69
|
-
> [!WARNING]
|
|
70
|
-
> Please note: Not all GQL and SQL syntax has been fully tested. Should you encounter any bugs, please post the relevant query and open an issue on GitHub.
|
|
71
|
-
|
|
72
|
-
## How to contribute
|
|
73
|
-
Feel free to open issues and pull requests on GitHub.
|
|
74
|
-
|
|
75
|
-
## Development Notes
|
|
76
|
-
- [Develop a SQLAlchemy and it's dialects](https://hackmd.io/lsBW5GCVR82SORyWZ1cssA?view)
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
python_datastore_sqlalchemy-0.0.2.dist-info/licenses/LICENSE,sha256=vcsHP9P3NtGefy7ojTRCgi3w0QqF_igVlmFP5A47YVA,1093
|
|
2
|
-
sqlalchemy_datastore/__init__.py,sha256=UmMpE_Sn41BU88qdX5KVvJPH7wMD2SufDBDQ-2cCwNQ,1239
|
|
3
|
-
sqlalchemy_datastore/_helpers.py,sha256=bRvNeMz6QgJMW1M5K-dXksdnURYBZE-NIzt3tue92rg,4854
|
|
4
|
-
sqlalchemy_datastore/_types.py,sha256=zs-Gr1XPP-UnppzsuWHEmD-wshkuosXM7yGeUIt-VVY,5092
|
|
5
|
-
sqlalchemy_datastore/base.py,sha256=QpgQ19h9LA2h86TH14w4h_Ilg9_St76qrwD5r3Ln4bA,9322
|
|
6
|
-
sqlalchemy_datastore/datastore_dbapi.py,sha256=xJVZR0Ymzj1XjB6-UeWQRHRLLYLzlOrjaYOEv3-13lY,94404
|
|
7
|
-
sqlalchemy_datastore/parse_url.py,sha256=sTeNqBm-V4Dec97R4K264qvG05aUXG7iNFyKNCNkPJ8,10058
|
|
8
|
-
python_datastore_sqlalchemy-0.0.2.dist-info/METADATA,sha256=zQgLqKvD-e8nqx-WLy2wGXhDjcOFiUD5ibrASBsXZbs,2471
|
|
9
|
-
python_datastore_sqlalchemy-0.0.2.dist-info/WHEEL,sha256=YCfwYGOYMi5Jhw2fU4yNgwErybb2IX5PEwBKV4ZbdBo,91
|
|
10
|
-
python_datastore_sqlalchemy-0.0.2.dist-info/entry_points.txt,sha256=h54O-P7HFeCKpoeQ-XSSyP_GVZ1FRAY3gFCS5lkDBIs,77
|
|
11
|
-
python_datastore_sqlalchemy-0.0.2.dist-info/top_level.txt,sha256=SE6uZfiwIQaJ1RDBfMm37dm7ZIZoqDcwQ1fDm32x0Rg,21
|
|
12
|
-
python_datastore_sqlalchemy-0.0.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|