hi all,
I'm having problems with database.metadata.create_all.
The code works perfectly with PostgreSQL but with Oracle it
doesn't...and it exits with the following error:
...
self._execute_raw(context)
File "/usr/lib/python2.4/site-packages/sqlalchemy/engine/base.py",
line 581, in _execute_raw
self._execute(context)
File "/usr/lib/python2.4/site-packages/sqlalchemy/engine/base.py",
line 599, in _execute
raise exceptions.SQLError(context.statement, context.parameters, e)
sqlalchemy.exceptions.SQLError: (DatabaseError) ORA-00942: table or view
does not exist
'\nCREATE TABLE tariffa (\n\tid INTEGER NOT NULL,
\n\tcod_funzione_calcolo VARCHAR(5) NOT NULL, \n\tPRIMARY KEY (id), \n\t
FOREIGN KEY(cod_funzione_calcolo) REFERENCES funzione_calcolo
(codice)\n)\n\n' {}
here the source...
-----------------------------------------------------------------------
from turbogears import database
from sqlalchemy import *
from sqlalchemy.ext.assignmapper import assign_mapper
from sqlalchemy.ext.selectresults import SelectResultsExt
database.bind_meta_data()
session = database.session
engine = database.metadata.engine
context = database.session.context
tbl = {}
tbl['funzione_calcolo']=Table('funzione_calcolo',database.metadata,
Column('codice', Unicode(5),nullable=False,primary_key=True),
Column('descrizione', Unicode(200), nullable=False),
)
tbl['tariffa']=Table('tariffa',database.metadata,
Column('id', Integer, Sequence('tariffa_seq'), nullable=False,
primary_key=True),
Column('cod_funzione_calcolo', Unicode(5), nullable=False),
ForeignKeyConstraint(['cod_funzione_calcolo'],['funzione_calcolo.codice']),
)
database.metadata.create_all(engine)
-------------------------------------------------------------------------------
what's wrong ?
jo
ps:
I'm using SA 0.3.10
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---