为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。
SQLAlchemy 1.4.46
sqlalchemy-dm 1.4.39
使用如下语句时
table = Table(table_name, metadata, autoload_with=engine, schema=schema)
print(f"表名: {table.name}")
for column in table.columns:
print(f"列名: {column.name}, 类型: {column.type}")
engine.connect().execute(select(
[table.c.hhr_task_id]).where(table.c.TENANT_ID == 3)).fetchone()
会报
KeyError: 'hhr_task_id'
The above exception was the direct cause of the following exception:
只有把hhr_task_id 改为大写才可以使用
希望得到回复,如何使用小写的时候 也能访问对应的列
检查下数据库的大小写敏感设置select SF_GET_CASE_SENSITIVE_FLAG(),返回1表示敏感,表名列名区分大小写