Oracle: swallowed error message at table creation
I tried to use an existing SA model in Oracle; that model works well in both postgres and mysql.
Running against Oracle, one table in the model was not being created.
The table name was "product". I changed the table name to "product2" then create_all() was able to create the table.
Here's the table definition:
product_table = Table('product', metadata, Column('product_id', Integer, Sequence('product_seq'), primary_key=True), Column('product_code', Unicode(20), unique=True, nullable=False, key="productCode" ), Column('product_name', Unicode(100), key="productName"), Column('description', Unicode(100)), Column('max_width', Numeric(10,3), default=0.00, nullable=False, key="maximumWidth"), Column('max_height', Numeric(10,3), default=0.00, nullable=False, key="maximumHeight"), Column('created', DateTime, nullable=False, default=datetime.now) )
Replace 'product' with 'product2' and table creation succeeds.
Comments (4)
-
Account Deleted -
repo owner - changed status to wontfix
from sqlalchemy import * from datetime import datetime engine = create_engine("oracle://scott:tiger@127.0.0.1:1521", echo="debug") metadata = MetaData(engine) product_table = Table('product', metadata, Column('product_id', Integer, Sequence('product_seq'), primary_key=True), Column('product_code', Unicode(20), unique=True, nullable=False, key="productCode" ), Column('product_name', Unicode(100), key="productName"), Column('description', Unicode(100)), Column('max_width', Numeric(10,3), default=0.00, nullable=False, key="maximumWidth"), Column('max_height', Numeric(10,3), default=0.00, nullable=False, key="maximumHeight"), Column('created', DateTime, nullable=False, default=datetime.now) ) metadata.create_all() 2007-10-14 12:53:01,002 INFO sqlalchemy.engine.base.Engine.0x..34 select table_name from all_tables where table_name=:name 2007-10-14 12:53:01,003 INFO sqlalchemy.engine.base.Engine.0x..34 {'name': 'PRODUCT'} 2007-10-14 12:53:01,018 INFO sqlalchemy.engine.base.Engine.0x..34 select sequence_name from all_sequences where sequence_name=:name 2007-10-14 12:53:01,019 INFO sqlalchemy.engine.base.Engine.0x..34 {'name': 'PRODUCT_SEQ'} 2007-10-14 12:53:01,026 INFO sqlalchemy.engine.base.Engine.0x..34 CREATE SEQUENCE product_seq 2007-10-14 12:53:01,027 INFO sqlalchemy.engine.base.Engine.0x..34 None 2007-10-14 12:53:01,057 INFO sqlalchemy.engine.base.Engine.0x..34 COMMIT 2007-10-14 12:53:01,065 INFO sqlalchemy.engine.base.Engine.0x..34 CREATE TABLE product ( product_id INTEGER NOT NULL, product_code VARCHAR(20) NOT NULL, product_name VARCHAR(100), description VARCHAR(100), max_width NUMERIC(10, 3) NOT NULL, max_height NUMERIC(10, 3) NOT NULL, created DATE NOT NULL, PRIMARY KEY (product_id), UNIQUE (product_code) ) 2007-10-14 12:53:01,066 INFO sqlalchemy.engine.base.Engine.0x..34 None 2007-10-14 12:53:01,999 INFO sqlalchemy.engine.base.Engine.0x..34 COMMIT
-
repo owner what is almost certainly happening is that the "product" table already exists. drop all tables first.
-
Account Deleted That's what I thought, but the table does not exist. We're going with Postgres in any case... all's happy there.
- Log in to comment
Also: same problem with table named 'customer'.. changed to 'customer2' and no problem.