Closed
Description
Describe the bug
To Reproduce
from sqlalchemy import create_engine
from sqlalchemy import select
from sqlalchemy import text
# non-working MCVE edited by mike
engine = create_engine('sqlite://', echo=False)
one_col_sql = 'select 1 as col1'
multi_col_sql = 'select 1 as col1, 2 as col2'
def go(sql):
table = text(sql).columns().alias()
q = select(['*']).select_from(table)
proxy = engine.execute(q)
print(proxy.keys())
go(multi_col_sql)
go(one_col_sql)
Error
-Werror
flag: python -Werror myprogram.py
if query single column, eg: query(one_col_sql) == ['*'],
but if query column more than 1, eg: query(multi_col_sql) == ['apartment_id', 'apartment_name']
Versions.
- OS:
- Python: 3.8.*
- SQLAlchemy: 1.3.* & 1.4.*
- Database: postgresql
- DBAPI:postgresql
Additional context
Have a nice day!
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
sqla-tester commentedon Jun 23, 2021
Mike Bayer has proposed a fix for this issue in the master branch:
consider "*" col as textual ordered https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/2887
zzzeek commentedon Jun 23, 2021
thanks for reporting