I'm wondering where I can specify that the tables that I want are in
the schema DataTables instead of 'dbo'. The engine.echo outuput shows
that for some reason my connection defaulted to the dbo schema, which
is not currently desired.

Second, the database that I connected to has tables in both the dbo
and DataTables schema, yet my code to list tables, actually lists no
tables.

The output from the program is rather short:
<!-- ~/Documents/DataProc/Development/data/source/KE_Agreements
tbrannon --> ./proc.py
conn_url mssql://pex6:[EMAIL PROTECTED]:1433/DATA
<tables>
</tables>
2007-02-13 15:38:32,241 INFO sqlalchemy.engine.base.Engine.0x..10
SELECT [COLUMNS_5569].[TABLE_SCHEMA], [COLUMNS_5569].[TABLE_NAME],
[COLUMNS_5569].[COLUMN_NAME], [COLUMNS_5569].[IS_NULLABLE],
[COLUMNS_5569].[DATA_TYPE], [COLUMNS_5569].[ORDINAL_POSITION],
[COLUMNS_5569].[CHARACTER_MAXIMUM_LENGTH], [COLUMNS_5569].
[NUMERIC_PRECISION], [COLUMNS_5569].[NUMERIC_SCALE], [COLUMNS_5569].
[COLUMN_DEFAULT]
FROM [INFORMATION_SCHEMA].[COLUMNS] AS [COLUMNS_5569]
WHERE [COLUMNS_5569].[TABLE_NAME] = %(COLUMNS_TABLE_NAME)s AND
[COLUMNS_5569].[TABLE_SCHEMA] = %(COLUMNS_TABLE_SCHEMA)s ORDER BY
[COLUMNS_5569].[ORDINAL_POSITION]
2007-02-13 15:38:32,241 INFO sqlalchemy.engine.base.Engine.0x..10
{'COLUMNS_TABLE_NAME': 'KEContracts', 'COLUMNS_TABLE_SCHEMA': 'dbo'}
Traceback (most recent call last):
  File "./proc.py", line 15, in <module>
    ke_contracts = Table('KEContracts', sa.metadata,
autoload=True).insert()
  File "build/bdist.macosx-10.4-i386/egg/sqlalchemy/schema.py", line
143, in __call__
  File "build/bdist.macosx-10.4-i386/egg/sqlalchemy/engine/base.py",
line 505, in reflecttable
  File "build/bdist.macosx-10.4-i386/egg/sqlalchemy/databases/
mssql.py", line 407, in reflecttable
sqlalchemy.exceptions.NoSuchTableError: KEContracts
<!-- ~/Documents/DataProc/Development/data/source/KE_Agreements
tbrannon -->


=======================================

My class to create db connections:

class sqlalchemy:

    def __init__(self, ip="24.129.182.44", db="DATA"):
        conn_url = "mssql://perl2:[EMAIL PROTECTED]:1433/%s" % (ip, db)
        print "conn_url", conn_url
        self.engine = create_engine(conn_url)
        self.engine.echo=True
        self.metadata = BoundMetaData(self.engine)

=========================================

my main code:

sa = data.config.db.sqlalchemy()

print "<tables>"
for t in sa.metadata.table_iterator():
    print t.name
print "</tables>"

ke_contracts = Table('KEContracts', sa.metadata,
autoload=True).insert()


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to