diff --git a/README.md b/README.md
index c0ec867..41e3eba 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
[![Functional tests](https://github.com/ydb-platform/ydb-sqlalchemy/actions/workflows/tests.yml/badge.svg)](https://github.com/ydb-platform/ydb-sqlalchemy/actions/workflows/tests.yml)
[![Style checks](https://github.com/ydb-platform/ydb-sqlalchemy/actions/workflows/style.yml/badge.svg)](https://github.com/ydb-platform/ydb-sqlalchemy/actions/workflows/style.yml)
-This repository contains YQL dialect for SqlAlchemy 2.0.
+This repository contains YDB dialect for SqlAlchemy 2.0.
**Note**: Dialect also works with SqlAlchemy 1.4, but it is not fully tested.
@@ -24,7 +24,7 @@ Connect to local YDB using SqlAlchemy:
import sqlalchemy as sa
-engine = sa.create_engine("yql+ydb://localhost:2136/local")
+engine = sa.create_engine("ydb://localhost:2136/local")
with engine.connect() as conn:
rs = conn.execute(sa.text("SELECT 1 AS value"))
diff --git a/examples/alembic/README.md b/examples/alembic/README.md
index 58da6e3..86cbfa7 100644
--- a/examples/alembic/README.md
+++ b/examples/alembic/README.md
@@ -28,7 +28,7 @@ from alembic.ddl.impl import DefaultImpl
class YDBImpl(DefaultImpl):
- __dialect__ = "yql"
+ __dialect__ = "ydb"
```
Secondly, since `YDB` do not support updating primary key columns, we have to update alembic table structure.
diff --git a/examples/alembic/alembic.ini b/examples/alembic/alembic.ini
index f988bfc..a572498 100644
--- a/examples/alembic/alembic.ini
+++ b/examples/alembic/alembic.ini
@@ -61,7 +61,7 @@ version_path_separator = os # Use os.pathsep. Default configuration used for ne
# are written from script.py.mako
# output_encoding = utf-8
-sqlalchemy.url = yql+ydb://localhost:2136/local
+sqlalchemy.url = ydb+ydb_sync://localhost:2136/local
[post_write_hooks]
diff --git a/examples/alembic/migrations/env.py b/examples/alembic/migrations/env.py
index c812e8a..682e214 100644
--- a/examples/alembic/migrations/env.py
+++ b/examples/alembic/migrations/env.py
@@ -32,7 +32,7 @@
class YDBImpl(DefaultImpl):
- __dialect__ = "yql"
+ __dialect__ = "ydb"
def run_migrations_offline() -> None:
diff --git a/examples/basic_example/example.py b/examples/basic_example/example.py
index 96f75bc..bdb1bfe 100644
--- a/examples/basic_example/example.py
+++ b/examples/basic_example/example.py
@@ -186,7 +186,7 @@ def run_example_core(engine):
def main():
- engine = sa.create_engine("yql+ydb://localhost:2136/local")
+ engine = sa.create_engine("ydb+ydb_sync://localhost:2136/local")
logging.basicConfig(level=logging.INFO)
logging.getLogger("_sqlalchemy.engine").setLevel(logging.INFO)
diff --git a/examples/jupyter_notebook/YDB SQLAlchemy + Jupyter Notebook Example.ipynb b/examples/jupyter_notebook/YDB SQLAlchemy + Jupyter Notebook Example.ipynb
index 2e214e3..57167b4 100644
--- a/examples/jupyter_notebook/YDB SQLAlchemy + Jupyter Notebook Example.ipynb
+++ b/examples/jupyter_notebook/YDB SQLAlchemy + Jupyter Notebook Example.ipynb
@@ -378,7 +378,7 @@
"source": [
"import sqlalchemy as sa\n",
"\n",
- "engine = sa.create_engine(\"yql+ydb://localhost:2136/local\")\n",
+ "engine = sa.create_engine(\"ydb+ydb_sync://localhost:2136/local\")\n",
"conn = engine.connect()"
]
},
@@ -933,10 +933,10 @@
{
"data": {
"text/html": [
- "Running query in 'yql+ydb://localhost:2136/local'"
+ "Running query in 'ydb+ydb_sync://localhost:2136/local'"
],
"text/plain": [
- "Running query in 'yql+ydb://localhost:2136/local'"
+ "Running query in 'ydb+ydb_sync://localhost:2136/local'"
]
},
"metadata": {},
@@ -1078,10 +1078,10 @@
{
"data": {
"text/html": [
- "Running query in 'yql+ydb://localhost:2136/local'"
+ "Running query in 'ydb+ydb_sync://localhost:2136/local'"
],
"text/plain": [
- "Running query in 'yql+ydb://localhost:2136/local'"
+ "Running query in 'ydb+ydb_sync://localhost:2136/local'"
]
},
"metadata": {},
diff --git a/setup.cfg b/setup.cfg
index 650a160..b7d28da 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -6,6 +6,6 @@ requirement_cls=ydb_sqlalchemy.sqlalchemy.requirements:Requirements
profile_file=test/profiles.txt
[db]
-default=yql+ydb://localhost:2136/local
-ydb=yql+ydb://localhost:2136/local
-ydb_async=yql+ydb_async://localhost:2136/local
+default=ydb+ydb_sync://localhost:2136/local
+ydb=ydb+ydb_sync://localhost:2136/local
+ydb_async=ydb+ydb_async://localhost:2136/local
diff --git a/setup.py b/setup.py
index 4845053..71756ba 100644
--- a/setup.py
+++ b/setup.py
@@ -38,11 +38,10 @@
},
entry_points={
"sqlalchemy.dialects": [
- "yql.ydb=ydb_sqlalchemy.sqlalchemy:YqlDialect",
- "yql.ydb_async=ydb_sqlalchemy.sqlalchemy:AsyncYqlDialect",
- "ydb_async=ydb_sqlalchemy.sqlalchemy:AsyncYqlDialect",
- "ydb=ydb_sqlalchemy.sqlalchemy:YqlDialect",
- "yql=ydb_sqlalchemy.sqlalchemy:YqlDialect",
+ "ydb=ydb_sqlalchemy.sqlalchemy:YDBDialect",
+ "ydb.ydb_sync=ydb_sqlalchemy.sqlalchemy:YDBDialect",
+ "ydb_async=ydb_sqlalchemy.sqlalchemy:AsyncYDBDialect",
+ "ydb.ydb_async=ydb_sqlalchemy.sqlalchemy:AsyncYDBDialect",
]
},
)
diff --git a/test/conftest.py b/test/conftest.py
index 5c0ed41..e6b672d 100644
--- a/test/conftest.py
+++ b/test/conftest.py
@@ -1,11 +1,10 @@
import pytest
from sqlalchemy.dialects import registry
-registry.register("yql.ydb", "ydb_sqlalchemy.sqlalchemy", "YqlDialect")
-registry.register("yql.ydb_async", "ydb_sqlalchemy.sqlalchemy", "AsyncYqlDialect")
-registry.register("ydb_async", "ydb_sqlalchemy.sqlalchemy", "AsyncYqlDialect")
-registry.register("ydb", "ydb_sqlalchemy.sqlalchemy", "YqlDialect")
-registry.register("yql", "ydb_sqlalchemy.sqlalchemy", "YqlDialect")
+registry.register("ydb", "ydb_sqlalchemy.sqlalchemy", "YDBDialect")
+registry.register("ydb.ydb_sync", "ydb_sqlalchemy.sqlalchemy", "YDBDialect")
+registry.register("ydb_async", "ydb_sqlalchemy.sqlalchemy", "AsyncYDBDialect")
+registry.register("ydb.ydb_async", "ydb_sqlalchemy.sqlalchemy", "AsyncYDBDialect")
pytest.register_assert_rewrite("sqlalchemy.testing.assertions")
from sqlalchemy.testing.plugin.pytestplugin import * # noqa: E402, F401, F403
diff --git a/test/test_core.py b/test/test_core.py
index 3f7d808..4632d85 100644
--- a/test/test_core.py
+++ b/test/test_core.py
@@ -594,7 +594,7 @@ def test_connection_set(self, connection_no_trans):
class TestEngine(TestBase):
__backend__ = True
- __only_on__ = "yql+ydb"
+ __only_on__ = "ydb+ydb_sync"
@pytest.fixture(scope="class")
def ydb_driver(self):
@@ -649,7 +649,7 @@ def test_sa_null_pool_with_ydb_shared_session_pool(self, ydb_driver, ydb_pool):
class TestAsyncEngine(TestEngine):
- __only_on__ = "yql+ydb_async"
+ __only_on__ = "ydb+ydb_async"
@pytest.fixture(scope="class")
def ydb_driver(self):
diff --git a/ydb_sqlalchemy/__init__.py b/ydb_sqlalchemy/__init__.py
index 55ade24..6c1776c 100644
--- a/ydb_sqlalchemy/__init__.py
+++ b/ydb_sqlalchemy/__init__.py
@@ -1,4 +1,4 @@
from ._version import VERSION # noqa: F401
from ydb_dbapi import IsolationLevel # noqa: F401
from .sqlalchemy import Upsert, types, upsert # noqa: F401
-import ydb_dbapi as dbapi
+import ydb_dbapi as dbapi # noqa: F401
diff --git a/ydb_sqlalchemy/sqlalchemy/__init__.py b/ydb_sqlalchemy/sqlalchemy/__init__.py
index 7bdf8f8..c16802f 100644
--- a/ydb_sqlalchemy/sqlalchemy/__init__.py
+++ b/ydb_sqlalchemy/sqlalchemy/__init__.py
@@ -82,23 +82,23 @@ def _get_column_info(t):
class YdbRequestSettingsCharacteristic(characteristics.ConnectionCharacteristic):
- def reset_characteristic(self, dialect: "YqlDialect", dbapi_connection: ydb_dbapi.Connection) -> None:
+ def reset_characteristic(self, dialect: "YDBDialect", dbapi_connection: ydb_dbapi.Connection) -> None:
dialect.reset_ydb_request_settings(dbapi_connection)
def set_characteristic(
- self, dialect: "YqlDialect", dbapi_connection: ydb_dbapi.Connection, value: ydb.BaseRequestSettings
+ self, dialect: "YDBDialect", dbapi_connection: ydb_dbapi.Connection, value: ydb.BaseRequestSettings
) -> None:
dialect.set_ydb_request_settings(dbapi_connection, value)
def get_characteristic(
- self, dialect: "YqlDialect", dbapi_connection: ydb_dbapi.Connection
+ self, dialect: "YDBDialect", dbapi_connection: ydb_dbapi.Connection
) -> ydb.BaseRequestSettings:
return dialect.get_ydb_request_settings(dbapi_connection)
-class YqlDialect(StrCompileDialect):
- name = "yql"
- driver = "ydb"
+class YDBDialect(StrCompileDialect):
+ name = "ydb"
+ driver = "ydb_sync"
supports_alter = False
max_identifier_length = 63
@@ -441,7 +441,7 @@ def do_execute(
cursor.execute(operation, parameters)
-class AsyncYqlDialect(YqlDialect):
+class AsyncYDBDialect(YDBDialect):
driver = "ydb_async"
is_async = True
supports_statement_cache = True
diff --git a/ydb_sqlalchemy/sqlalchemy/dml.py b/ydb_sqlalchemy/sqlalchemy/dml.py
index dce418b..eba9504 100644
--- a/ydb_sqlalchemy/sqlalchemy/dml.py
+++ b/ydb_sqlalchemy/sqlalchemy/dml.py
@@ -3,11 +3,11 @@
class Upsert(sa.sql.Insert):
__visit_name__ = "upsert"
- _propagate_attrs = {"compile_state_plugin": "yql"}
- stringify_dialect = "yql"
+ _propagate_attrs = {"compile_state_plugin": "ydb"}
+ stringify_dialect = "ydb"
inherit_cache = False
-@sa.sql.base.CompileState.plugin_for("yql", "upsert")
+@sa.sql.base.CompileState.plugin_for("ydb", "upsert")
class UpsertDMLState(sa.sql.dml.InsertDMLState):
pass
diff --git a/ydb_sqlalchemy/sqlalchemy/test_sqlalchemy.py b/ydb_sqlalchemy/sqlalchemy/test_sqlalchemy.py
index de8b446..f34935a 100644
--- a/ydb_sqlalchemy/sqlalchemy/test_sqlalchemy.py
+++ b/ydb_sqlalchemy/sqlalchemy/test_sqlalchemy.py
@@ -1,10 +1,10 @@
import sqlalchemy as sa
-from . import YqlDialect, types
+from . import YDBDialect, types
def test_casts():
- dialect = YqlDialect()
+ dialect = YDBDialect()
expr = sa.literal_column("1/2")
res_exprs = [