Replies: 3 comments
-
As per https://clickhouse-sqlalchemy.readthedocs.io/en/latest/ Use SQLalchemy 1.4.x |
Beta Was this translation helpful? Give feedback.
-
Bingo, you are right:) from sqlalchemy import create_engine, Column, MetaData
from clickhouse_sqlalchemy import (
Table, make_session, get_declarative_base, types, engines
)
uri = 'clickhouse+native://localhost/default'
engine = create_engine(uri)
session = make_session(engine)
metadata = MetaData(bind=engine)
Base = get_declarative_base(metadata=metadata)
class Rate(Base):
day = Column(types.Date, primary_key=True)
value = Column(types.Int32)
__table_args__ = (
engines.Memory(),
) how to integrate with flask_sqlalchemy db.Model? |
Beta Was this translation helpful? Give feedback.
-
It looks like they didn't write a proper sqlalchemy engine but do their own stuff on top of it. Looks like a mess tbh. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I want to use clickhouse as a backend database in flask project.
Want to make sure whether flask-sqlalchemy support clickhouse?
Raised error:
db = SQLAlchemy(app) -- trigger by this code
...
xxx/site-packages/clickhouse_sqlalchemy/sql/schema.py", line 2, in
from sqlalchemy.sql.base import (
ImportError: cannot import name '_bind_or_error' from 'sqlalchemy.sql.base' (xxx/site-packages/sqlalchemy/sql/base.py)
Environment:
- clickhouse-sqlalchemy==0.2.3
Beta Was this translation helpful? Give feedback.
All reactions