On 5/29/15 6:36 PM, Wavemaker wrote:
Hello All,

I'm trying to use Alembic for versioning my Camelot (http://www.python-camelot.com) schema, which is essentially sqlalchemy on the database side. When using autogenerate I get a NoSuchTableError. The odd thing is that I get this error for a table "auth_user" that cannot find in my schema:

[snip]
  File "F:\Workspace\MyProject\src\virtualenv\Lib\site-packages\sqlalc
hemy\util\langhelpers.py", line 60, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File "F:\Workspace\MyProject\src\virtualenv\Lib\site-packages\sqlalc
hemy\sql\schema.py", line 432, in __new__
    table._init(name, metadata, *args, **kw)
  File "F:\Workspace\MyProject\src\virtualenv\Lib\site-packages\sqlalc
hemy\sql\schema.py", line 513, in _init
    self._autoload(metadata, autoload_with, include_columns)
  File "F:\Workspace\MyProject\src\virtualenv\Lib\site-packages\sqlalc
hemy\sql\schema.py", line 528, in _autoload
    self, include_columns, exclude_columns
  File "F:\Workspace\MyProject\src\virtualenv\Lib\site-packages\sqlalc
hemy\engine\base.py", line 1481, in run_callable
    return callable_(self, *args, **kwargs)
  File "F:\Workspace\MyProject\src\virtualenv\Lib\site-packages\sqlalc
hemy\engine\default.py", line 364, in reflecttable
    return insp.reflecttable(table, include_columns, exclude_columns)
  File "F:\Workspace\MyProject\src\virtualenv\Lib\site-packages\sqlalc
hemy\engine\reflection.py", line 578, in reflecttable
    raise exc.NoSuchTableError(table.name)
sqlalchemy.exc.NoSuchTableError: auth_user

Note: line numbers may be slightly different from the official alembic/sqlalchemy releases as I inserted some debug print/log statements. If helpful I can of course resort to the stock release.
not really sure, that trace is just within SQLAlchemy and I can't see where Alembic is attempting to locate a table of that name. Would need to at least see the stack trace going up into alembic's autogenerate logic.

Alembic shouldn't be trying to reflect a table of a certain name unless it detected that name when it asked the database for all table names.

Things to suspect are, casing problems, e.g. if your database has something like Auth_User on it, I see this is windows, if this is MySQL (is it?) the casing behavior changes based on operating system.


It doesn't matter whether I use an existing or a freshly initialized database. I was trying to follow the code to see where Alembic comes up with this additional table, but I get lost. Can somebody tell me some hints on how Alembic can come up with tables not directly defined in my schema?
it really can't.   Share your env.py as well.


I then hope I can figure whether I need that table at all. Another question however is why would alembic not handle the situation and simple create the new table, even if I am unaware that I need it?

Thanks!
--
You received this message because you are subscribed to the Google Groups "sqlalchemy-alembic" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy-alembic+unsubscr...@googlegroups.com <mailto:sqlalchemy-alembic+unsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy-alembic" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy-alembic+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to