ibmdbanalytics / ibmdbpy

A Pandas-like SQL-wrapper for in-database analytics with IBM Db2.
https://pythonhosted.org/ibmdbpy/
Other
23 stars 11 forks source link

ibmdbpy Can not Cope with Lowercase Table Names #22

Open bassel-zeidan opened 7 years ago

bassel-zeidan commented 7 years ago

Background

While trying to access a table in dashDB instance using the code:

from ibmdbpy import IdaDataBase, IdaDataFrame

idadb_1 = IdaDataBase(dsn='DASHDB;Database=BLUDB;Hostname=`<hostname>`;Port=50000;PROTOCOL=TCPIP;UID=`<UID>`;PWD=`<PASSWORD>`')
ida_df_1 = IdaDataFrame(idadb_1, 'schema.target_table')
ida_df_1.head()

, the user gets an exception complaining about that the table doesn't exist in the database.

When executing the command:

idadb_1.show_tables()

It clearly shows that the table is in the DB and under the selected schema. It also shows that the user (entered as UID previously) is the owner of the table.

nicoleschoen commented 7 years ago

hi bassel-zeidan, so your table is in the user default schema? If not, did you specify schema.table for the passed in table name? Currently ibmdbpy has a limitation with mixed-case table names. Is your table name mixed case?

In addition you may turn on verbose mode to see exactly the underlying SELECT statements that are run on your dashdb instance that should give a clue on why dashdb does not find the table. To enable verbose mode: idadb = IdaDataBase(..., verbose=True)

bassel-zeidan commented 7 years ago

Hi Nicole, Yes the table is in the user default schema. I tried also schema.table and got the same result. The table only has lower case letters but the name has underscoreslabor_force_csv I tried setting verbose to true. I didn't get much info to detect where the issue is.

bassel-zeidan commented 7 years ago

Thanks Nicole for looking into this. It turns out that this issue is caused by the fact that ibmdbpy can't cope with lowercase table names. I will update the name of this issue and keep it for you as a reference to follow up on this.

mhaideibm commented 7 years ago

Will leave this issue open for now as our mission has changed. Will start discussion with dashDB team who will be the new analytic owner. But in the sample above have you ever tried to use it like: ida_df_1 = IdaDataFrame(idadb_1, '"schema"."target_table"') I have not tried it but this is the way I would do it when working native against dashDB with mixed case.