Skip to content

Commit 91f206e

Browse files
author
Peng Ren
committed
Register dialect
1 parent 2e30a41 commit 91f206e

File tree

5 files changed

+8
-5
lines changed

5 files changed

+8
-5
lines changed

MANIFEST.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ include requirements-test.txt
88

99
# Include configuration files
1010
include pyproject.toml
11-
include .flake8
1211

1312
# Exclude unnecessary files
1413
global-exclude *.pyc

pymongosql/sqlalchemy_mongodb/sqlalchemy_dialect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ class PyMongoSQLDialect(default.DefaultDialect):
164164
Compatible with SQLAlchemy 1.4+ and 2.x versions.
165165
"""
166166

167-
name = "pymongosql"
167+
name = "mongodb"
168168
driver = "pymongosql"
169169

170170
# Version compatibility

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ Repository = "https://github.com/passren/PyMongoSQL.git"
5353
Documentation = "https://github.com/passren/PyMongoSQL/wiki"
5454
"Bug Reports" = "https://github.com/passren/PyMongoSQL/issues"
5555

56+
[project.entry-points."sqlalchemy.dialects"]
57+
mongodb = "pymongosql.sqlalchemy_mongodb.sqlalchemy_dialect:PyMongoSQLDialect"
58+
"mongodb+srv" = "pymongosql.sqlalchemy_mongodb.sqlalchemy_dialect:PyMongoSQLDialect"
59+
5660
[tool.black]
5761
line-length = 120
5862
target-version = ['py39']

tests/test_sqlalchemy_dialect.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def setUp(self):
6060

6161
def test_dialect_name(self):
6262
"""Test dialect name and driver."""
63-
self.assertEqual(self.dialect.name, "pymongosql")
63+
self.assertEqual(self.dialect.name, "mongodb")
6464
self.assertEqual(self.dialect.driver, "pymongosql")
6565

6666
def test_dbapi(self):
@@ -312,7 +312,7 @@ def test_engine_creation(self, mock_connect):
312312
# This should not raise an exception
313313
engine = create_engine("mongodb://localhost:27017/testdb")
314314
self.assertIsNotNone(engine)
315-
self.assertEqual(engine.dialect.name, "pymongosql")
315+
self.assertEqual(engine.dialect.name, "mongodb")
316316

317317
# Test version compatibility attributes
318318
if hasattr(engine.dialect, "_sqlalchemy_version"):

tests/test_sqlalchemy_integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class TestSQLAlchemyIntegration:
152152
def test_engine_creation(self, sqlalchemy_engine):
153153
"""Test that SQLAlchemy engine works with real MongoDB."""
154154
assert sqlalchemy_engine is not None
155-
assert sqlalchemy_engine.dialect.name == "pymongosql"
155+
assert sqlalchemy_engine.dialect.name == "mongodb"
156156

157157
# Test that we can get a connection
158158
with sqlalchemy_engine.connect() as connection:

0 commit comments

Comments
 (0)