baztian / jaydebeapi

JayDeBeApi module allows you to connect from Python code to databases using Java JDBC. It provides a Python DB-API v2.0 to that database.
GNU Lesser General Public License v3.0
364 stars 147 forks source link

python connection: SQL column renaming doesn't work #246

Open leahwangibm opened 3 months ago

leahwangibm commented 3 months ago

Hi,

I noticed that the SQL renaming clause AS doesn't work if there are no operations on those columns, AS renaming wouldn't work. e.g.

SELECT TRIM(COL_A) AS NEW_COL_A, 
               COL_B AS NEW_COL_B

we will end up with a dataframe has header as NEW_COL_A and COL_B. Has anyone else encountered the same issue before?

query="""<SQL query>"""
df = pd.read_sql(query, db_conn) # db_conn is the database instance I set up via jaydebeapi

Thanks in advance!