The tables are not in an explicitly named schema. By default, it uses the schema of the user logged in. Looking at the debug output on the console, I can see that it uses the correct schema i.e. SYSTEM.
I set the logging to debug and went through the whole process. I'll attach the entire output. I'm using flask-migrate, which just puts a nice wrapper around alembic for flask development purposes. So the 'migrate' command is a proxy an alias for autogenerate. 'upgrade' and 'downgrade' are the same. So please see the output attached. Thank you. Nana -- 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.
(sqliteenv)Nanas-MacBook-Pro:data_upload_sqlite okyere$ python manage.py db init Creating directory /Users/okyere/Repos/data_upload_sqlite/migrations ... done Creating directory /Users/okyere/Repos/data_upload_sqlite/migrations/versions ... done Generating /Users/okyere/Repos/data_upload_sqlite/migrations/alembic.ini ... done Generating /Users/okyere/Repos/data_upload_sqlite/migrations/env.py ... done Generating /Users/okyere/Repos/data_upload_sqlite/migrations/README ... done Generating /Users/okyere/Repos/data_upload_sqlite/migrations/script.py.mako ... done Please edit configuration/connection/logging settings in '/Users/okyere/Repos/data_upload_sqlite/migrations/alembic.ini' before proceeding. (sqliteenv)Nanas-MacBook-Pro:data_upload_sqlite okyere$ python manage.py db migrate INFO [sqlalchemy.engine.base.Engine] SELECT USER FROM DUAL INFO [sqlalchemy.engine.base.Engine] {} DEBUG [sqlalchemy.engine.base.Engine] Col ('USER',) DEBUG [sqlalchemy.engine.base.Engine] Row ('SYSTEM',) INFO [sqlalchemy.engine.base.Engine] SELECT CAST('test plain returns' AS VARCHAR(60 CHAR)) AS anon_1 FROM DUAL INFO [sqlalchemy.engine.base.Engine] {} INFO [sqlalchemy.engine.base.Engine] SELECT CAST('test unicode returns' AS NVARCHAR2(60)) AS anon_1 FROM DUAL INFO [sqlalchemy.engine.base.Engine] {} INFO [alembic.runtime.migration] Context impl OracleImpl. INFO [alembic.runtime.migration] Will assume non-transactional DDL. INFO [sqlalchemy.engine.base.Engine] SELECT table_name FROM all_tables WHERE table_name = :name AND owner = :schema_name INFO [sqlalchemy.engine.base.Engine] {'schema_name': 'SYSTEM', 'name': 'ALEMBIC_VERSION'} DEBUG [sqlalchemy.engine.base.Engine] Col ('TABLE_NAME',) INFO [sqlalchemy.engine.base.Engine] SELECT table_name FROM all_tables WHERE table_name = :name AND owner = :schema_name INFO [sqlalchemy.engine.base.Engine] {'schema_name': 'SYSTEM', 'name': 'ALEMBIC_VERSION'} DEBUG [sqlalchemy.engine.base.Engine] Col ('TABLE_NAME',) INFO [sqlalchemy.engine.base.Engine] CREATE TABLE alembic_version ( version_num VARCHAR2(32 CHAR) NOT NULL ) INFO [sqlalchemy.engine.base.Engine] {} INFO [sqlalchemy.engine.base.Engine] COMMIT INFO [sqlalchemy.engine.base.Engine] SELECT table_name FROM all_tables WHERE nvl(tablespace_name, 'no tablespace') NOT IN ('SYSTEM', 'SYSAUX') AND OWNER = :owner AND IOT_NAME IS NULL AND DURATION IS NULL INFO [sqlalchemy.engine.base.Engine] {'owner': 'SYSTEM'} DEBUG [sqlalchemy.engine.base.Engine] Col ('TABLE_NAME',) INFO [alembic.autogenerate.compare] Detected added table 'dut_departments' INFO [alembic.autogenerate.compare] Detected added table 'dut_field_types' INFO [alembic.autogenerate.compare] Detected added table 'dut_uploadslog' INFO [alembic.autogenerate.compare] Detected added table 'dut_tables_info' INFO [alembic.autogenerate.compare] Detected added table 'dut_fields' Generating /Users/okyere/Repos/data_upload_sqlite/migrations/versions/34dacf7310ff_.py ... done (sqliteenv)Nanas-MacBook-Pro:data_upload_sqlite okyere$ python manage.py db upgrade INFO [sqlalchemy.engine.base.Engine] SELECT USER FROM DUAL INFO [sqlalchemy.engine.base.Engine] {} DEBUG [sqlalchemy.engine.base.Engine] Col ('USER',) DEBUG [sqlalchemy.engine.base.Engine] Row ('SYSTEM',) INFO [sqlalchemy.engine.base.Engine] SELECT CAST('test plain returns' AS VARCHAR(60 CHAR)) AS anon_1 FROM DUAL INFO [sqlalchemy.engine.base.Engine] {} INFO [sqlalchemy.engine.base.Engine] SELECT CAST('test unicode returns' AS NVARCHAR2(60)) AS anon_1 FROM DUAL INFO [sqlalchemy.engine.base.Engine] {} INFO [alembic.runtime.migration] Context impl OracleImpl. INFO [alembic.runtime.migration] Will assume non-transactional DDL. INFO [sqlalchemy.engine.base.Engine] SELECT table_name FROM all_tables WHERE table_name = :name AND owner = :schema_name INFO [sqlalchemy.engine.base.Engine] {'schema_name': 'SYSTEM', 'name': 'ALEMBIC_VERSION'} DEBUG [sqlalchemy.engine.base.Engine] Col ('TABLE_NAME',) DEBUG [sqlalchemy.engine.base.Engine] Row ('ALEMBIC_VERSION',) INFO [sqlalchemy.engine.base.Engine] SELECT alembic_version.version_num FROM alembic_version INFO [sqlalchemy.engine.base.Engine] {} DEBUG [sqlalchemy.engine.base.Engine] Col ('VERSION_NUM',) INFO [sqlalchemy.engine.base.Engine] SELECT table_name FROM all_tables WHERE table_name = :name AND owner = :schema_name INFO [sqlalchemy.engine.base.Engine] {'schema_name': 'SYSTEM', 'name': 'ALEMBIC_VERSION'} DEBUG [sqlalchemy.engine.base.Engine] Col ('TABLE_NAME',) DEBUG [sqlalchemy.engine.base.Engine] Row ('ALEMBIC_VERSION',) INFO [alembic.runtime.migration] Running upgrade -> 34dacf7310ff, empty message INFO [sqlalchemy.engine.base.Engine] CREATE TABLE dut_departments ( id INTEGER NOT NULL, name VARCHAR2(120 CHAR) NOT NULL, PRIMARY KEY (id), UNIQUE (name) ) INFO [sqlalchemy.engine.base.Engine] {} INFO [sqlalchemy.engine.base.Engine] COMMIT INFO [sqlalchemy.engine.base.Engine] CREATE TABLE dut_field_types ( id INTEGER NOT NULL, name VARCHAR2(120 CHAR) NOT NULL, python_type VARCHAR2(120 CHAR), python_import VARCHAR2(120 CHAR), PRIMARY KEY (id), UNIQUE (name) ) INFO [sqlalchemy.engine.base.Engine] {} INFO [sqlalchemy.engine.base.Engine] COMMIT INFO [sqlalchemy.engine.base.Engine] CREATE TABLE dut_uploadslog ( id INTEGER NOT NULL, user_name VARCHAR2(120 CHAR) NOT NULL, user_cwsid VARCHAR2(120 CHAR) NOT NULL, last_name VARCHAR2(120 CHAR), file_name VARCHAR2(120 CHAR) NOT NULL, destination_table VARCHAR2(120 CHAR) NOT NULL, timestamp TIMESTAMP NOT NULL, PRIMARY KEY (id) ) INFO [sqlalchemy.engine.base.Engine] {} INFO [sqlalchemy.engine.base.Engine] COMMIT INFO [sqlalchemy.engine.base.Engine] CREATE TABLE dut_tables_info ( id INTEGER NOT NULL, descriptive_name VARCHAR2(120 CHAR) NOT NULL, table_name VARCHAR2(30 CHAR) NOT NULL, department_id INTEGER, PRIMARY KEY (id), FOREIGN KEY(department_id) REFERENCES dut_departments (id), UNIQUE (descriptive_name), UNIQUE (table_name) ) INFO [sqlalchemy.engine.base.Engine] {} INFO [sqlalchemy.engine.base.Engine] COMMIT INFO [sqlalchemy.engine.base.Engine] CREATE TABLE dut_fields ( id INTEGER NOT NULL, name VARCHAR2(120 CHAR) NOT NULL, fieldtype_id INTEGER, tableinfo_id INTEGER, PRIMARY KEY (id), FOREIGN KEY(fieldtype_id) REFERENCES dut_field_types (id), FOREIGN KEY(tableinfo_id) REFERENCES dut_tables_info (id) ) INFO [sqlalchemy.engine.base.Engine] {} INFO [sqlalchemy.engine.base.Engine] COMMIT INFO [sqlalchemy.engine.base.Engine] INSERT INTO alembic_version (version_num) VALUES ('34dacf7310ff') INFO [sqlalchemy.engine.base.Engine] {} INFO [sqlalchemy.engine.base.Engine] COMMIT (sqliteenv)Nanas-MacBook-Pro:data_upload_sqlite okyere$ ### About to do another autogenerate since I deleted a column in one of the models (sqliteenv)Nanas-MacBook-Pro:data_upload_sqlite okyere$ python manage.py db migrate INFO [sqlalchemy.engine.base.Engine] SELECT USER FROM DUAL INFO [sqlalchemy.engine.base.Engine] {} DEBUG [sqlalchemy.engine.base.Engine] Col ('USER',) DEBUG [sqlalchemy.engine.base.Engine] Row ('SYSTEM',) INFO [sqlalchemy.engine.base.Engine] SELECT CAST('test plain returns' AS VARCHAR(60 CHAR)) AS anon_1 FROM DUAL INFO [sqlalchemy.engine.base.Engine] {} INFO [sqlalchemy.engine.base.Engine] SELECT CAST('test unicode returns' AS NVARCHAR2(60)) AS anon_1 FROM DUAL INFO [sqlalchemy.engine.base.Engine] {} INFO [alembic.runtime.migration] Context impl OracleImpl. INFO [alembic.runtime.migration] Will assume non-transactional DDL. INFO [sqlalchemy.engine.base.Engine] SELECT table_name FROM all_tables WHERE table_name = :name AND owner = :schema_name INFO [sqlalchemy.engine.base.Engine] {'name': 'ALEMBIC_VERSION', 'schema_name': 'SYSTEM'} DEBUG [sqlalchemy.engine.base.Engine] Col ('TABLE_NAME',) DEBUG [sqlalchemy.engine.base.Engine] Row ('ALEMBIC_VERSION',) INFO [sqlalchemy.engine.base.Engine] SELECT alembic_version.version_num FROM alembic_version INFO [sqlalchemy.engine.base.Engine] {} DEBUG [sqlalchemy.engine.base.Engine] Col ('VERSION_NUM',) DEBUG [sqlalchemy.engine.base.Engine] Row ('34dacf7310ff',) INFO [sqlalchemy.engine.base.Engine] SELECT table_name FROM all_tables WHERE nvl(tablespace_name, 'no tablespace') NOT IN ('SYSTEM', 'SYSAUX') AND OWNER = :owner AND IOT_NAME IS NULL AND DURATION IS NULL INFO [sqlalchemy.engine.base.Engine] {'owner': 'SYSTEM'} DEBUG [sqlalchemy.engine.base.Engine] Col ('TABLE_NAME',) INFO [alembic.autogenerate.compare] Detected added table 'dut_departments' INFO [alembic.autogenerate.compare] Detected added table 'dut_field_types' INFO [alembic.autogenerate.compare] Detected added table 'dut_uploadslog' INFO [alembic.autogenerate.compare] Detected added table 'dut_tables_info' INFO [alembic.autogenerate.compare] Detected added table 'dut_fields' Generating /Users/okyere/Repos/data_upload_sqlite/migrations/versions/08f3a17d96bb_.py ... done (sqliteenv)Nanas-MacBook-Pro:data_upload_sqlite okyere$ python manage.py db upgrade INFO [sqlalchemy.engine.base.Engine] SELECT USER FROM DUAL INFO [sqlalchemy.engine.base.Engine] {} DEBUG [sqlalchemy.engine.base.Engine] Col ('USER',) DEBUG [sqlalchemy.engine.base.Engine] Row ('SYSTEM',) INFO [sqlalchemy.engine.base.Engine] SELECT CAST('test plain returns' AS VARCHAR(60 CHAR)) AS anon_1 FROM DUAL INFO [sqlalchemy.engine.base.Engine] {} INFO [sqlalchemy.engine.base.Engine] SELECT CAST('test unicode returns' AS NVARCHAR2(60)) AS anon_1 FROM DUAL INFO [sqlalchemy.engine.base.Engine] {} INFO [alembic.runtime.migration] Context impl OracleImpl. INFO [alembic.runtime.migration] Will assume non-transactional DDL. INFO [sqlalchemy.engine.base.Engine] SELECT table_name FROM all_tables WHERE table_name = :name AND owner = :schema_name INFO [sqlalchemy.engine.base.Engine] {'name': 'ALEMBIC_VERSION', 'schema_name': 'SYSTEM'} DEBUG [sqlalchemy.engine.base.Engine] Col ('TABLE_NAME',) DEBUG [sqlalchemy.engine.base.Engine] Row ('ALEMBIC_VERSION',) INFO [sqlalchemy.engine.base.Engine] SELECT alembic_version.version_num FROM alembic_version INFO [sqlalchemy.engine.base.Engine] {} DEBUG [sqlalchemy.engine.base.Engine] Col ('VERSION_NUM',) DEBUG [sqlalchemy.engine.base.Engine] Row ('34dacf7310ff',) INFO [alembic.runtime.migration] Running upgrade 34dacf7310ff -> 08f3a17d96bb, empty message INFO [sqlalchemy.engine.base.Engine] CREATE TABLE dut_departments ( id INTEGER NOT NULL, name VARCHAR2(120 CHAR) NOT NULL, PRIMARY KEY (id), UNIQUE (name) ) INFO [sqlalchemy.engine.base.Engine] {} INFO [sqlalchemy.engine.base.Engine] ROLLBACK Traceback (most recent call last): File "/Users/okyere/miniconda3/envs/sqliteenv/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context context) File "/Users/okyere/miniconda3/envs/sqliteenv/lib/python3.4/site-packages/sqlalchemy/engine/default.py", line 450, in do_execute cursor.execute(statement, parameters) cx_Oracle.DatabaseError: ORA-00955: name is already used by an existing object The above exception was the direct cause of the following exception: Traceback (most recent call last): File "manage.py", line 16, in <module> manager.run() File "/Users/okyere/miniconda3/envs/sqliteenv/lib/python3.4/site-packages/flask_script/__init__.py", line 412, in run result = self.handle(sys.argv[0], sys.argv[1:]) File "/Users/okyere/miniconda3/envs/sqliteenv/lib/python3.4/site-packages/flask_script/__init__.py", line 383, in handle res = handle(*args, **config) File "/Users/okyere/miniconda3/envs/sqliteenv/lib/python3.4/site-packages/flask_script/commands.py", line 216, in __call__ return self.run(*args, **kwargs) File "/Users/okyere/miniconda3/envs/sqliteenv/lib/python3.4/site-packages/flask_migrate/__init__.py", line 233, in upgrade command.upgrade(config, revision, sql=sql, tag=tag) File "/Users/okyere/miniconda3/envs/sqliteenv/lib/python3.4/site-packages/alembic/command.py", line 174, in upgrade script.run_env() File "/Users/okyere/miniconda3/envs/sqliteenv/lib/python3.4/site-packages/alembic/script/base.py", line 397, in run_env util.load_python_file(self.dir, 'env.py') File "/Users/okyere/miniconda3/envs/sqliteenv/lib/python3.4/site-packages/alembic/util/pyfiles.py", line 81, in load_python_file module = load_module_py(module_id, path) File "/Users/okyere/miniconda3/envs/sqliteenv/lib/python3.4/site-packages/alembic/util/compat.py", line 68, in load_module_py module_id, path).load_module(module_id) File "<frozen importlib._bootstrap>", line 539, in _check_name_wrapper File "<frozen importlib._bootstrap>", line 1614, in load_module File "<frozen importlib._bootstrap>", line 596, in _load_module_shim File "<frozen importlib._bootstrap>", line 1220, in load File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked File "<frozen importlib._bootstrap>", line 1129, in _exec File "<frozen importlib._bootstrap>", line 1471, in exec_module File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed File "migrations/env.py", line 87, in <module> run_migrations_online() File "migrations/env.py", line 80, in run_migrations_online context.run_migrations() File "<string>", line 8, in run_migrations File "/Users/okyere/miniconda3/envs/sqliteenv/lib/python3.4/site-packages/alembic/runtime/environment.py", line 797, in run_migrations self.get_context().run_migrations(**kw) File "/Users/okyere/miniconda3/envs/sqliteenv/lib/python3.4/site-packages/alembic/runtime/migration.py", line 312, in run_migrations step.migration_fn(**kw) File "/Users/okyere/Repos/data_upload_sqlite/migrations/versions/08f3a17d96bb_.py", line 23, in upgrade sa.UniqueConstraint('name') File "<string>", line 8, in create_table File "<string>", line 3, in create_table File "/Users/okyere/miniconda3/envs/sqliteenv/lib/python3.4/site-packages/alembic/operations/ops.py", line 1098, in create_table return operations.invoke(op) File "/Users/okyere/miniconda3/envs/sqliteenv/lib/python3.4/site-packages/alembic/operations/base.py", line 318, in invoke return fn(self, operation) File "/Users/okyere/miniconda3/envs/sqliteenv/lib/python3.4/site-packages/alembic/operations/toimpl.py", line 101, in create_table operations.impl.create_table(table) File "/Users/okyere/miniconda3/envs/sqliteenv/lib/python3.4/site-packages/alembic/ddl/impl.py", line 194, in create_table self._exec(schema.CreateTable(table)) File "/Users/okyere/miniconda3/envs/sqliteenv/lib/python3.4/site-packages/alembic/ddl/oracle.py", line 22, in _exec result = super(OracleImpl, self)._exec(construct, *args, **kw) File "/Users/okyere/miniconda3/envs/sqliteenv/lib/python3.4/site-packages/alembic/ddl/impl.py", line 118, in _exec return conn.execute(construct, *multiparams, **params) File "/Users/okyere/miniconda3/envs/sqliteenv/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 914, in execute return meth(self, multiparams, params) File "/Users/okyere/miniconda3/envs/sqliteenv/lib/python3.4/site-packages/sqlalchemy/sql/ddl.py", line 68, in _execute_on_connection return connection._execute_ddl(self, multiparams, params) File "/Users/okyere/miniconda3/envs/sqliteenv/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 968, in _execute_ddl compiled File "/Users/okyere/miniconda3/envs/sqliteenv/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1146, in _execute_context context) File "/Users/okyere/miniconda3/envs/sqliteenv/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1341, in _handle_dbapi_exception exc_info File "/Users/okyere/miniconda3/envs/sqliteenv/lib/python3.4/site-packages/sqlalchemy/util/compat.py", line 189, in raise_from_cause reraise(type(exception), exception, tb=exc_tb, cause=exc_value) File "/Users/okyere/miniconda3/envs/sqliteenv/lib/python3.4/site-packages/sqlalchemy/util/compat.py", line 182, in reraise raise value.with_traceback(tb) File "/Users/okyere/miniconda3/envs/sqliteenv/lib/python3.4/site-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context context) File "/Users/okyere/miniconda3/envs/sqliteenv/lib/python3.4/site-packages/sqlalchemy/engine/default.py", line 450, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.DatabaseError: (cx_Oracle.DatabaseError) ORA-00955: name is already used by an existing object [SQL: '\nCREATE TABLE dut_departments (\n\tid INTEGER NOT NULL, \n\tname VARCHAR2(120 CHAR) NOT NULL, \n\tPRIMARY KEY (id), \n\tUNIQUE (name)\n)\n\n']