ydb-sqlalchemy
ydb-sqlalchemy copied to clipboard
YQL Dialect for SQLAlchemy
code ``` from sqlalchemy import Column, Integer, String, create_engine from sqlalchemy.dialects import registry from sqlalchemy.orm import declarative_base from sqlalchemy.orm import sessionmaker registry.register("yql.ydb", "ydb_sqlalchemy.sqlalchemy", "YqlDialect") registry.register("ydb", "ydb_sqlalchemy.sqlalchemy", "YqlDialect") registry.register("yql", "ydb_sqlalchemy.sqlalchemy", "YqlDialect")...
This PR aims to bring alembic to YDB I'm not sure what are the changes needed to make that happen, I'm basically fixing the issues I encounter as I go...
Support migration for ydb-sqlalchemy via alembic https://alembic.sqlalchemy.org/en/latest/
Support YDB as a data source for [SuperSet](https://superset.apache.org/docs/databases/db-connection-ui#how-to-add-new-database-engines-to-available-endpoint) (now uses sqlalchemy
https://github.com/ydb-platform/ydb-sqlalchemy/blob/main/tests/test_core.py#L159
Run Tests: `$ pytest -vv test/test_suite.py::NumericTest`
Run Tests: `$ pytest -vv test/test_suite.py::BinaryTest` Failed with: `sqlalchemy.exc.StatementError: (builtins.AttributeError) module 'ydb_sqlalchemy.dbapi' has no attribute 'Binary'`
Roadmap: - [x] #5 - [x] dbapi: - [x] OLTP (use execute instead of scan_query) - [x] support yql statements with parameters (declare generation) - [x] tests - [x] #15...
Now support simple no auth connection only: https://github.com/ydb-platform/ydb-sqlalchemy/blob/48cc1c2e53a9c23be6dc371177dda644a6447b00/ydb_sqlalchemy/dbapi/connection.py#L37 Workaround: initialize ydb.Driver and pass it by `ydb_session_pool` option.