I'm trying to make sequences in the Oracle database. Here's my model def init(): #conf = paste.deploy.CONFIG #uri = conf['sqlalchemy.dburi'] if 'login' in session: uri=1 else: conf = paste.deploy.CONFIG uri = conf['sqlalchemy.dburi'] /// Admin rights here engine = create_engine(uri, convert_unicode=True) # meta.bind = engine engine.echo = True meta.connect(engine)
application_sequence = Sequence('Application_id_seq', optional=True) application_table = Table ( 'Application', meta, Column('ID_Application', Integer, application_sequence, primary_key=True), Column('ID_Seller', Integer, nullable=False), Column('ID_Lot', Integer, nullable=False), Column('ID_Sell', Integer, nullable=False), Column('Text_Application', String(2048)), Column('Date_Start_Application', DateTime, default=func.current_timestamp()), Column('ID_Status', Integer), Column('Date_Change_Application', DateTime), Column('Date_Finish_Application', DateTime), ForeignKeyConstraint(['ID_Sell', 'ID_Lot'], ['data.Lot.ID_Sell', 'data.Lot.ID_Lot'], ondelete="CASCADE"), schema='data' ) Websetup is done like this def setup_config(command, filename, section, vars): conf = paste.deploy.appconfig('config:' + filename) conf.update(dict(app_conf=conf.local_conf, global_conf=conf.global_conf)) paste.deploy.CONFIG.push_process_config(conf) uri = conf['sqlalchemy.dburi_data'] // Here i log in as the Data scheme engine = create_engine(uri) print "Connecting to database %s ..." % uri model.meta.connect(engine) # Add some basic values into the table..... ////// Everything works fine during websetup. It adds the values in the table, since i assume it can see the Sequence. But during the work with the model, since it logs in as different Schema, it cann't see the Sequence. After that i changed it to application_doc_sequence = Sequence('data.APPLICATION_DOC_ID_SEQ', optional=True) the model can see it just well, works great. But when it comed to websetup it fails. After clearing the database by hand, i decided to take a look at how websetup will handle it from the blank database. Now it works, but when it comes to websetup it gives me this: name is already used by an existing object As it turns out it creates a sequence named 'data.APPLICATION_DOC_ID_SEQ', which is not exactly right i guess. My assumption would be that they treat this string differently. Model can see the schema to look for, but websetup takes literally as a string but on the other hand refuses to delete it during drop_all. Probably that's a well known issue and it's fixed in 0.4 or maybe it's me (which is in fact far more likely since i'm new to alchemy). Anyway, i'd be delighted if you guys will point it out to me. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---