Hi,
A schema is being used. My schema name and database name is the same.
Here is a
compelte example that I just worked through.
First I created the SAMPLE database on AIX/DB2.
-- Login as db2inst1 and create the SAMPLE database
-bash-3.00$ db2sampl
Creating database "SAMPLE"...
Connecting to database "SAMPLE"...
Creating tables and data in schema "DB2INST1"...
Creating tables with XML columns and XML data in schema
"DB2INST1"...
'db2sampl' processing complete.
-bash-3.00$
--- From Windows, connect to the SAMPLE database with schema DB2INST1
from sqlalchemy import *
metadata = MetaData()
db = create_engine('ibm_db_sa://db2inst1:password@host:50001/
SAMPLE;CurrentSchema=DB2INST1')
metadata.bind = db
conn = db.connect()
result = conn.execute("select * from EMPLOYEE")
for row in result:
print row
result.close()
employee = Table('EMPLOYEE', metadata, autoload=True)
print ""
print employee.columns
--- This all worked fine. I could see all the data in the EMPLOYEE
table
--- as well as all the columns of the EMPLOYEE table.
--- Next, I'm trying to use my own database called MYDATA for
arguments sake.
--- It assocaited schema is called MYDATA as well.
--- From Windows, connect to MYDATA database with schema MYDATA
from sqlalchemy import *
metadata = MetaData()
db = create_engine('ibm_db_sa://db2inst1:password@host:50001/
MYDATA;CurrentSchema=MYDATA')
metadata.bind = db
conn = db.connect()
result = conn.execute("select * from MY_TABLE")
for row in result:
print row
result.close()
table = Table('MY_TABLE', metadata, autoload=True)
print ""
print table.columns
--- The data in MY_TABLE is displayed by the select statement, but the
Table('') mapping fails.
I'm stuck. Hope there's some kind of workaround.
Thanks,
Werner