I've been trying to use ibm_db_dbi to connect the database and read table by pandas.read_sql.
After creating the connection, I use set_current_schema('mySchema') to set the current schema for myConnection, so that I don't need to specify the schema in front of every tables.
However, when I read table by using pd.read_sql(sql, myConnection), it always uses the username as the schema, not the scheme that I specified.
Is there a way to fix it?
Any help would be appreciated.
Thanks,
Terry
import ibm_db_dbi as db2
import pandas as pd
myConnection = db2.connect("DATABASE=name;HOSTNAME=host;PORT=port;PROTOCOL=TCPIP;UID=username;PWD=password;", " ", " ")
myConnection.set_current_schema('mySchema')
sql = ('SELECT NAME FROM EMPLOYEE')
names = pd.read_sql(sql, myConnection)