one.person
View profile
         More options Jun 12, 5:12 pm
From: "one.person" <[EMAIL PROTECTED]>
Date: Wed, 13 Jun 2007 00:12:50 -0000
Local: Tues, Jun 12 2007 5:12 pm
Subject: Re: mssql reflection NoSuchTableError
Reply | Reply to author | Forward | Print | Individual message | Show
original | Remove | Report this message | Find messages by this author
Thanks for the quick reply, I have additional info after more
experimentation.  This works fine in a single python session as shown:

>>> from sqlalchemy import *
>>> db = create_engine('mssql://login:[EMAIL PROTECTED]/dbname')
>>> metadata = BoundMetaData(db)
>>> z_table = Table('z_table', metadata,

                Column('col1', Integer),
                Column('col2', String(20))
                )

>>> z_table.create()
>>> z_table_test = Table('z_table', metadata, autoload=True)
>>> [c.name for c in z_table_test.columns]
['col1', 'col2']

However, if I shut down python and start a new session (I am using
IDLE btw), it will not pick up the table it just created:

>>> from sqlalchemy import *
>>> db = create_engine('mssql://login:[EMAIL PROTECTED]/dbname')
>>> metadata = BoundMetaData(db)
>>> z_table_test = Table('z_table', metadata, autoload=True)

Traceback (most recent call last):
  File "<pyshell#3>", line 1, in -toplevel-
    z_table_test = Table('z_table', metadata, autoload=True)
  File "build\bdist.win32\egg\sqlalchemy\schema.py", line 166, in
__call__
  File "build\bdist.win32\egg\sqlalchemy\engine\base.py", line 809, in
reflecttable
  File "build\bdist.win32\egg\sqlalchemy\databases\mssql.py", line
506, in reflecttable
NoSuchTableError: z_table


Consequently when I do the above I cannot reflect any of the pre-
existing tables in the database.

When I check the database itself 'z_table' really does exist and I can
query it in Query Analyzer and modify it in Enterprise Manager.

Thanks again for your help!


--~--~---------~--~----~------------~-------~--~----~
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