mindsdb / dfsql

SQL interface to Pandas
GNU General Public License v3.0
51 stars 9 forks source link

KeyError if 'ORDER BY' contains table name #42

Open StpMax opened 3 years ago

StpMax commented 3 years ago

This query produce KeyError('COLUMNS.ORDINAL_POSITION') :

dfsql.sql_query(
    "SELECT * FROM COLUMNS WHERE COLUMNS.TABLE_SCHEMA = 'MINDSDB' AND COLUMNS.TABLE_NAME = 'predictors' ORDER BY COLUMNS.ORDINAL_POSITION",
    ds_kwargs={'case_sensitive': False},
    reduce_output=False,
    **{table_name: dataframe}
)

Dataframe has column 'ORDINAL_POSITION'

CCCCCCCE commented 2 years ago

dfsql.sql_query( "SELECT * FROM COLUMNS WHERE COLUMNS.TABLE_SCHEMA = 'MINDSDB' AND COLUMNS.TABLE_NAME = 'predictors' ORDER BY COLUMNS.ORDINAL_POSITION", ds_kwargs={'case_sensitive': False}, reduce_output=False, **{table_name: dataframe} )

after and columns.column_name should be there instead of table name

tomhuds commented 1 year ago

@StpMax can we archive this project? or close issue?