python-datastore-sqlalchemy 0.0.2__tar.gz → 0.0.4__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.
Files changed (32) hide show
  1. python_datastore_sqlalchemy-0.0.4/PKG-INFO +98 -0
  2. python_datastore_sqlalchemy-0.0.4/README.md +65 -0
  3. python_datastore_sqlalchemy-0.0.4/pyproject.toml +91 -0
  4. python_datastore_sqlalchemy-0.0.4/python_datastore_sqlalchemy.egg-info/PKG-INFO +98 -0
  5. {python_datastore_sqlalchemy-0.0.2 → python_datastore_sqlalchemy-0.0.4}/python_datastore_sqlalchemy.egg-info/SOURCES.txt +0 -1
  6. python_datastore_sqlalchemy-0.0.4/setup.py +22 -0
  7. {python_datastore_sqlalchemy-0.0.2 → python_datastore_sqlalchemy-0.0.4}/sqlalchemy_datastore/__init__.py +1 -1
  8. {python_datastore_sqlalchemy-0.0.2 → python_datastore_sqlalchemy-0.0.4}/sqlalchemy_datastore/base.py +9 -2
  9. {python_datastore_sqlalchemy-0.0.2 → python_datastore_sqlalchemy-0.0.4}/tests/test_integration_queries.py +12 -6
  10. {python_datastore_sqlalchemy-0.0.2 → python_datastore_sqlalchemy-0.0.4}/tests/test_unit_types.py +8 -1
  11. python_datastore_sqlalchemy-0.0.2/PKG-INFO +0 -76
  12. python_datastore_sqlalchemy-0.0.2/README.md +0 -32
  13. python_datastore_sqlalchemy-0.0.2/pyproject.toml +0 -21
  14. python_datastore_sqlalchemy-0.0.2/python_datastore_sqlalchemy.egg-info/PKG-INFO +0 -76
  15. python_datastore_sqlalchemy-0.0.2/python_datastore_sqlalchemy.egg-info/not-zip-safe +0 -1
  16. python_datastore_sqlalchemy-0.0.2/setup.py +0 -80
  17. {python_datastore_sqlalchemy-0.0.2 → python_datastore_sqlalchemy-0.0.4}/LICENSE +0 -0
  18. {python_datastore_sqlalchemy-0.0.2 → python_datastore_sqlalchemy-0.0.4}/python_datastore_sqlalchemy.egg-info/dependency_links.txt +0 -0
  19. {python_datastore_sqlalchemy-0.0.2 → python_datastore_sqlalchemy-0.0.4}/python_datastore_sqlalchemy.egg-info/entry_points.txt +0 -0
  20. {python_datastore_sqlalchemy-0.0.2 → python_datastore_sqlalchemy-0.0.4}/python_datastore_sqlalchemy.egg-info/requires.txt +0 -0
  21. {python_datastore_sqlalchemy-0.0.2 → python_datastore_sqlalchemy-0.0.4}/python_datastore_sqlalchemy.egg-info/top_level.txt +0 -0
  22. {python_datastore_sqlalchemy-0.0.2 → python_datastore_sqlalchemy-0.0.4}/setup.cfg +0 -0
  23. {python_datastore_sqlalchemy-0.0.2 → python_datastore_sqlalchemy-0.0.4}/sqlalchemy_datastore/_helpers.py +0 -0
  24. {python_datastore_sqlalchemy-0.0.2 → python_datastore_sqlalchemy-0.0.4}/sqlalchemy_datastore/_types.py +0 -0
  25. {python_datastore_sqlalchemy-0.0.2 → python_datastore_sqlalchemy-0.0.4}/sqlalchemy_datastore/datastore_dbapi.py +0 -0
  26. {python_datastore_sqlalchemy-0.0.2 → python_datastore_sqlalchemy-0.0.4}/sqlalchemy_datastore/parse_url.py +0 -0
  27. {python_datastore_sqlalchemy-0.0.2 → python_datastore_sqlalchemy-0.0.4}/tests/test_datastore.py +0 -0
  28. {python_datastore_sqlalchemy-0.0.2 → python_datastore_sqlalchemy-0.0.4}/tests/test_gql.py +0 -0
  29. {python_datastore_sqlalchemy-0.0.2 → python_datastore_sqlalchemy-0.0.4}/tests/test_orm.py +0 -0
  30. {python_datastore_sqlalchemy-0.0.2 → python_datastore_sqlalchemy-0.0.4}/tests/test_unit_base.py +0 -0
  31. {python_datastore_sqlalchemy-0.0.2 → python_datastore_sqlalchemy-0.0.4}/tests/test_unit_dbapi.py +0 -0
  32. {python_datastore_sqlalchemy-0.0.2 → python_datastore_sqlalchemy-0.0.4}/tests/test_unit_helpers.py +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,65 @@
1
+ SQLAlchemy dialect for Google Cloud Datastore in Firestore mode
2
+ ========================
3
+
4
+ ## Installation
5
+
6
+ Install from PyPI:
7
+ ```bash
8
+ pip install python-datastore-sqlalchemy
9
+ ```
10
+
11
+ Install from a local checkout:
12
+ ```bash
13
+ uv pip install -e .
14
+ ```
15
+
16
+ Runtime dependencies are declared in `pyproject.toml`. `requirements.txt` is not used by this project.
17
+
18
+ ## Usage
19
+
20
+ ```python
21
+ from sqlalchemy import create_engine, text
22
+
23
+ engine = create_engine(
24
+ "datastore://my-project/?database=my-db",
25
+ credentials="path/to/credentials.json",
26
+ )
27
+
28
+ with engine.connect() as conn:
29
+ result = conn.execute(text("SELECT * FROM test_table"))
30
+ print(result.fetchall())
31
+ ```
32
+
33
+ ## Preview
34
+
35
+ <img src="assets/pie.png">
36
+
37
+ > [!WARNING]
38
+ > 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.
39
+
40
+ ## How to contribute
41
+
42
+ Feel free to open issues and pull requests on GitHub.
43
+
44
+ ## Development
45
+
46
+ 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.
47
+
48
+ Install the development environment:
49
+ ```bash
50
+ uv sync --locked
51
+ ```
52
+
53
+ Run the test suite:
54
+ ```bash
55
+ uv run pytest
56
+ ```
57
+
58
+ 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:
59
+ ```bash
60
+ GCLOUD_PATH=/path/to/google-cloud-sdk/bin/gcloud uv run pytest
61
+ ```
62
+
63
+ ## Development Notes
64
+
65
+ - [Develop a SQLAlchemy and its dialects](https://hackmd.io/lsBW5GCVR82SORyWZ1cssA?view)
@@ -0,0 +1,91 @@
1
+ [build-system]
2
+ requires = ["setuptools>=64"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "python-datastore-sqlalchemy"
7
+ version = "0.0.4"
8
+ description = "SQLAlchemy dialect for google cloud datastore"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = { text = "MIT" }
12
+ authors = [
13
+ { name = "HY Chang(splasky)", email = "hychang.1997.tw@gmail.com" },
14
+ ]
15
+ classifiers = [
16
+ "Development Status :: 2 - Pre-Alpha",
17
+ "Intended Audience :: Developers",
18
+ "Programming Language :: Python",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3.11",
21
+ "Programming Language :: Python :: 3.12",
22
+ "Programming Language :: Python :: 3.13",
23
+ "Programming Language :: Python :: Implementation :: CPython",
24
+ "Topic :: Database :: Front-Ends",
25
+ "Operating System :: POSIX :: Linux",
26
+ ]
27
+ keywords = ["SQLAlchemy", "GCP", "Datastore"]
28
+ dependencies = [
29
+ "sqlalchemy>=1.4.16,<3.0.0",
30
+ "google-cloud-datastore>=2.21.0",
31
+ "google-cloud-firestore>=2.21.0",
32
+ "google-cloud-bigquery>=3.35.0",
33
+ "google-auth>=2.40.0",
34
+ "sqlglot>=28.0.0",
35
+ "pandas>=2.0.0",
36
+ "requests",
37
+ ]
38
+
39
+ [project.entry-points."sqlalchemy.dialects"]
40
+ datastore = "sqlalchemy_datastore:CloudDatastoreDialect"
41
+
42
+ [project.urls]
43
+ Documentation = "https://github.com/splasky/python-datastore-sqlalchemy/wiki"
44
+ Source = "https://github.com/splasky/python-datastore-sqlalchemy"
45
+ Tracker = "https://github.com/splasky/python-datastore-sqlalchemy/issues"
46
+
47
+ [dependency-groups]
48
+ dev = [
49
+ "coverage==7.9.2",
50
+ "flake8==7.3.0",
51
+ "mypy",
52
+ "pytest==9.0.3",
53
+ "pytest-cov==6.2.1",
54
+ "pytest-html==4.1.1",
55
+ "pytest-mypy==1.0.1",
56
+ "pytest-ruff==0.5",
57
+ "ruff",
58
+ ]
59
+
60
+
61
+
62
+ [tool.setuptools.packages.find]
63
+ include = ["sqlalchemy_datastore*"]
64
+
65
+ [tool.pytest.ini_options]
66
+ addopts = "--ruff --mypy --cov --cov-report=html"
67
+ pythonpath = ["."]
68
+ testpaths = ["tests"]
69
+ python_files = ["test_*.py"]
70
+
71
+ [tool.ruff]
72
+ line-length = 120
73
+
74
+ [tool.ruff.lint]
75
+ select = ["E", "F", "W", "I", "N", "B", "C", "G", "S"]
76
+ ignore = [
77
+ "E501", # Line too long - allow longer lines for SQL strings in tests
78
+ "S608", # SQL injection - intentional for test cases
79
+ "B007", # Loop variable not used - common in test assertions
80
+ ]
81
+
82
+ [tool.ruff.lint.per-file-ignores]
83
+ "tests/*" = ["S608", "E501", "S101", "B007", "S603"]
84
+
85
+ [tool.mypy]
86
+ ignore_missing_imports = true
87
+ disable_error_code = ["var-annotated", "import-untyped"]
88
+
89
+ [[tool.mypy.overrides]]
90
+ module = ["tests.*"]
91
+ ignore_errors = true
@@ -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)
@@ -6,7 +6,6 @@ python_datastore_sqlalchemy.egg-info/PKG-INFO
6
6
  python_datastore_sqlalchemy.egg-info/SOURCES.txt
7
7
  python_datastore_sqlalchemy.egg-info/dependency_links.txt
8
8
  python_datastore_sqlalchemy.egg-info/entry_points.txt
9
- python_datastore_sqlalchemy.egg-info/not-zip-safe
10
9
  python_datastore_sqlalchemy.egg-info/requires.txt
11
10
  python_datastore_sqlalchemy.egg-info/top_level.txt
12
11
  sqlalchemy_datastore/__init__.py
@@ -0,0 +1,22 @@
1
+ # Copyright (c) 2025 hychang <hychang.1997.tw@gmail.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ # this software and associated documentation files (the "Software"), to deal in
5
+ # the Software without restriction, including without limitation the rights to
6
+ # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7
+ # the Software, and to permit persons to whom the Software is furnished to do so,
8
+ # subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in all
11
+ # copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15
+ # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16
+ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
+ # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
+ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
+
20
+ from setuptools import setup
21
+
22
+ setup()
@@ -19,7 +19,7 @@
19
19
 
20
20
  from .base import CloudDatastoreDialect
21
21
 
22
- __version__ = "0.0.2"
22
+ __version__ = "0.0.4"
23
23
 
24
24
  __all__ = [
25
25
  "__version__",
@@ -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 dbapi(cls):
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 [
@@ -33,8 +33,10 @@ def test_update_user(conn, datastore_client):
33
33
 
34
34
  # Find the inserted entity by querying the datastore client directly
35
35
  query = datastore_client.query(kind="users")
36
- query.add_filter("name", "=", "UpdateTestUser")
37
- entities = list(query.fetch())
36
+ entities = [
37
+ entity for entity in query.fetch()
38
+ if entity.get("name") == "UpdateTestUser"
39
+ ]
38
40
  assert len(entities) >= 1
39
41
  entity_id = entities[0].key.id
40
42
 
@@ -62,8 +64,10 @@ def test_delete_user(conn, datastore_client):
62
64
 
63
65
  # Find the inserted entity
64
66
  query = datastore_client.query(kind="users")
65
- query.add_filter("name", "=", "DeleteTestUser")
66
- entities = list(query.fetch())
67
+ entities = [
68
+ entity for entity in query.fetch()
69
+ if entity.get("name") == "DeleteTestUser"
70
+ ]
67
71
  assert len(entities) >= 1
68
72
  entity_id = entities[0].key.id
69
73
 
@@ -332,8 +336,10 @@ def test_task_insert_update_delete_raw_sql(conn, datastore_client):
332
336
 
333
337
  # Find the inserted entity
334
338
  query = datastore_client.query(kind="tasks")
335
- query.add_filter("task", "=", "Coverage Test Task")
336
- entities = list(query.fetch())
339
+ entities = [
340
+ entity for entity in query.fetch()
341
+ if entity.get("task") == "Coverage Test Task"
342
+ ]
337
343
  assert len(entities) >= 1
338
344
  entity_id = entities[0].key.id
339
345
 
@@ -17,6 +17,7 @@
17
17
  # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
18
  # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
19
  """Unit tests for _types module (no emulator required)."""
20
+ import pytest
20
21
  import sqlalchemy.types
21
22
  from google.cloud.bigquery.schema import SchemaField
22
23
 
@@ -190,7 +191,13 @@ def test_get_sqla_column_type_repeated():
190
191
 
191
192
  def test_get_sqla_column_type_unknown():
192
193
  field = SchemaField("mystery", "UNKNOWN_TYPE_XYZ")
193
- coltype = _get_sqla_column_type(field)
194
+
195
+ with pytest.warns(
196
+ sqlalchemy.exc.SAWarning,
197
+ match="Did not recognize type 'UNKNOWN_TYPE_XYZ' of column 'mystery'",
198
+ ):
199
+ coltype = _get_sqla_column_type(field)
200
+
194
201
  assert coltype is sqlalchemy.types.NullType
195
202
 
196
203
 
@@ -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,32 +0,0 @@
1
- SQLAlchemy dialect for google cloud datastore(firestore mode)
2
- ========================
3
- How to install
4
- ```
5
- python3 setup.py install
6
- ```
7
- or
8
- ```
9
- pip install python-datastore-sqlalchemy
10
- ```
11
- How to use
12
- ```python
13
- from sqlalchemy import *
14
- from sqlalchemy.engine import create_engine
15
- from sqlalchemy.schema import *
16
- engine = create_engine("datastore://my-project/?database=my-db", credentials='path/to/credentials.json')
17
- conn = engine.connect()
18
- result = conn.execute("SELECT * fro" test_table")
19
- print(result.fetchall())
20
- ```
21
-
22
- ## Preview
23
- <img src="assets/pie.png">
24
-
25
- > [!WARNING]
26
- > 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.
27
-
28
- ## How to contribute
29
- Feel free to open issues and pull requests on GitHub.
30
-
31
- ## Development Notes
32
- - [Develop a SQLAlchemy and it's dialects](https://hackmd.io/lsBW5GCVR82SORyWZ1cssA?view)
@@ -1,21 +0,0 @@
1
- [tool.ruff]
2
- line-length = 120
3
-
4
- [tool.ruff.lint]
5
- select = ["E", "F", "W", "I", "N", "B", "C", "G", "S"]
6
- ignore = [
7
- "E501", # Line too long - allow longer lines for SQL strings in tests
8
- "S608", # SQL injection - intentional for test cases
9
- "B007", # Loop variable not used - common in test assertions
10
- ]
11
-
12
- [tool.ruff.lint.per-file-ignores]
13
- "tests/*" = ["S608", "E501", "S101", "B007", "S603"]
14
-
15
- [tool.mypy]
16
- ignore_missing_imports = true
17
- disable_error_code = ["var-annotated", "import-untyped"]
18
-
19
- [[tool.mypy.overrides]]
20
- module = ["tests.*"]
21
- ignore_errors = true
@@ -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,80 +0,0 @@
1
- # Copyright (c) 2025 hychang <hychang.1997.tw@gmail.com>
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy of
4
- # this software and associated documentation files (the "Software"), to deal in
5
- # the Software without restriction, including without limitation the rights to
6
- # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7
- # the Software, and to permit persons to whom the Software is furnished to do so,
8
- # subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in all
11
- # copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15
- # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16
- # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
- # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
- # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
-
20
- import os
21
- import re
22
-
23
- from setuptools import setup, find_packages
24
-
25
- with open(
26
- os.path.join(os.path.dirname(__file__), "sqlalchemy_datastore", "__init__.py")
27
- ) as v:
28
- version_match = re.compile(r'.*__version__ = "(.*?)"', re.S).match(v.read())
29
- if not version_match:
30
- raise RuntimeError("Unable to find version string in __init__.py.")
31
- VERSION = version_match.group(1)
32
-
33
- readme = os.path.join(os.path.dirname(__file__), "README.md")
34
- with open(readme) as f:
35
- long_description = f.read()
36
-
37
-
38
- setup(
39
- name="python-datastore-sqlalchemy",
40
- version=VERSION,
41
- description="SQLAlchemy dialect for google cloud datastore",
42
- long_description=long_description,
43
- long_description_content_type="text/markdown",
44
- url="https://github.com/splasky/python-datastore-sqlalchemy",
45
- author="HY Chang(splasky)",
46
- author_email="hychang.1997.tw@gmail.com",
47
- license="MIT",
48
- classifiers=[
49
- "Development Status :: 2 - Pre-Alpha",
50
- "Intended Audience :: Developers",
51
- "Programming Language :: Python",
52
- "Programming Language :: Python :: 3",
53
- "Programming Language :: Python :: Implementation :: CPython",
54
- "Topic :: Database :: Front-Ends",
55
- "Operating System :: POSIX :: Linux",
56
- ],
57
- keywords="SQLAlchemy GCP Datastore",
58
- python_requires=">=3.9",
59
- project_urls={
60
- "Documentation": "https://github.com/splasky/python-datastore-sqlalchemy/wiki",
61
- "Source": "https://github.com/splasky/python-datastore-sqlalchemy",
62
- "Tracker": "https://github.com/splasky/python-datastore-sqlalchemy/issues",
63
- },
64
- packages=find_packages(include=["sqlalchemy_datastore"]),
65
- include_package_data=True,
66
- install_requires=[
67
- "sqlalchemy>=1.4.16,<3.0.0",
68
- "google-cloud-datastore>=2.21.0",
69
- "google-cloud-firestore>=2.21.0",
70
- "google-cloud-bigquery>=3.35.0",
71
- "google-auth>=2.40.0",
72
- "sqlglot>=28.0.0",
73
- "pandas>=2.0.0",
74
- "requests",
75
- ],
76
- zip_safe=False,
77
- entry_points={
78
- "sqlalchemy.dialects": ["datastore = sqlalchemy_datastore:CloudDatastoreDialect"]
79
- },
80
- )