you'd get this from the dbapi:
>>> from sqlalchemy import create_engine
>>> e = create_engine("sqlite://")
>>> e.dialect.dbapi.sqlite_version
'3.34.1'
yeah that is probably the best approach
from sqlalchemy.sql import expression
from sqlalchemy.ext.compiler import compiles
class maybe_lower(expression.FunctionElement):
type = String()
@compiles(maybe_lower, 'sqlite')
def sl_maybe_lower(element, compiler, **kw):
args = list(element.clauses)
if compiler.dialect.dbapi_version < ...:
return "LOWER(%s)" % (compiler.process(args[0], **kw))
else:
return compiler.process(args[0], **kw)
@compiles(maybe_lower)
def default_maybe_lower(element, compiler, **kw):
args = list(element.clauses)
return compiler.process(args[0], **kw)
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
---
You received this message because you are subscribed to the Google Groups "sqlalchemy" group.