[sqlalchemy] identifier is too long

2010-03-30 Thread jo

Hi all,

I have some troubles creating my db schema with Oracle. The problem is 
on this column:


Column('cod_caratteristica_rischio', Unicode(10), index=True, 
nullable=False)


It works fine in PostgreSQL but when I try it on Oracle sa tries to 
create an index with a name too long ( 30 char).



tbl['rischio_attivita'] = Table('rischio_attivita', database.metadata,
Column('id', Integer, Sequence('rischio_attivita_seq'), primary_key=True),
Column('cod_attivita', Unicode(10),nullable=False),
Column('cod_caratteristica_rischio', Unicode(10), index=True, 
nullable=False),

Column('tipo_calcolo', Integer),
Column('algoritmo', Unicode(200)),
Column('fattore_x', Float, PassiveDefault('1.0')),
ForeignKeyConstraint(['cod_attivita'], ['attivita.codice']),
ForeignKeyConstraint(['cod_caratteristica_rischio'], 
['caratteristica_rischio.codice'])

)


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-00972: identifier is 
too long
'CREATE INDEX ix_rischio_attivita_cod_caratteristica_rischio ON 
rischio_attivita (cod_caratteristica_rischio)' {}



--
Jose Soares
Sferacarta Net 
Via Bazzanese 69

40033 Casalecchio di Reno
Bologna - Italy
Ph  +39051591054
fax +390516131537
web:www.sferacarta.com

Le informazioni contenute nella presente mail ed in ogni eventuale file 
allegato sono riservate e, comunque, destinate esclusivamente alla persona o 
ente sopraindicati, ai sensi del decreto legislativo 30 giugno 2003, n. 196. La 
diffusione, distribuzione e/o copiatura della mail trasmessa, da parte di 
qualsiasi soggetto diverso dal destinatario, sono vietate. La correttezza, 
l’integrità e la sicurezza della presente mail non possono essere garantite. Se 
avete ricevuto questa mail per errore, Vi preghiamo di contattarci 
immediatamente e di eliminarla. Grazie.

This communication is intended only for use by the addressee, pursuant to 
legislative decree 30 June 2003, n. 196. It may contain confidential or 
privileged information. You should not copy or use it to disclose its contents 
to any other person. Transmission cannot be guaranteed to be error-free, 
complete and secure. If you are not the intended recipient and receive this 
communication unintentionally, please inform us immediately and then delete 
this message from your system. Thank you.

--
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



Re: [sqlalchemy] identifier is too long

2010-03-30 Thread Mariano Mara
Excerpts from jo's message of Tue Mar 30 03:25:18 -0300 2010:
 Hi all,
 
 I have some troubles creating my db schema with Oracle. The problem is 
 on this column:
 
 Column('cod_caratteristica_rischio', Unicode(10), index=True, 
 nullable=False)
 
 It works fine in PostgreSQL but when I try it on Oracle sa tries to 
 create an index with a name too long ( 30 char).
 
 
 tbl['rischio_attivita'] = Table('rischio_attivita', database.metadata,
 Column('id', Integer, Sequence('rischio_attivita_seq'), primary_key=True),
 Column('cod_attivita', Unicode(10),nullable=False),
 Column('cod_caratteristica_rischio', Unicode(10), index=True, 
 nullable=False),
 Column('tipo_calcolo', Integer),
 Column('algoritmo', Unicode(200)),
 Column('fattore_x', Float, PassiveDefault('1.0')),
 ForeignKeyConstraint(['cod_attivita'], ['attivita.codice']),
 ForeignKeyConstraint(['cod_caratteristica_rischio'], 
 ['caratteristica_rischio.codice'])
 )
 
 
 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-00972: identifier is 
 too long
 'CREATE INDEX ix_rischio_attivita_cod_caratteristica_rischio ON 
 rischio_attivita (cod_caratteristica_rischio)' {}
 

Hi there, instead of creating the index as part of the Column
expression, use the Index[1] statement and assign a name yourself.

[1]
http://www.sqlalchemy.org/docs/reference/sqlalchemy/schema.html#sqlalchemy.schema.Index

 
 -- 
 Jose Soares
 Sferacarta Net 
 Via Bazzanese 69
 40033 Casalecchio di Reno
 Bologna - Italy
 Ph  +39051591054
 fax +390516131537
 web:www.sferacarta.com
 
 Le informazioni contenute nella presente mail ed in ogni eventuale file 
 allegato sono riservate e, comunque, destinate esclusivamente alla persona o 
 ente sopraindicati, ai sensi del decreto legislativo 30 giugno 2003, n. 196. 
 La diffusione, distribuzione e/o copiatura della mail trasmessa, da parte di 
 qualsiasi soggetto diverso dal destinatario, sono vietate. La correttezza, 
 l’integrità e la sicurezza della presente mail non possono essere garantite. 
 Se avete ricevuto questa mail per errore, Vi preghiamo di contattarci 
 immediatamente e di eliminarla. Grazie.
 
 This communication is intended only for use by the addressee, pursuant to 
 legislative decree 30 June 2003, n. 196. It may contain confidential or 
 privileged information. You should not copy or use it to disclose its 
 contents to any other person. Transmission cannot be guaranteed to be 
 error-free, complete and secure. If you are not the intended recipient and 
 receive this communication unintentionally, please inform us immediately and 
 then delete this message from your system. Thank you.
 

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



Re: [sqlalchemy] identifier is too long

2010-03-30 Thread jo

I see, thank you, Mariano.
j
Mariano Mara wrote:

Excerpts from jo's message of Tue Mar 30 03:25:18 -0300 2010:
  

Hi all,

I have some troubles creating my db schema with Oracle. The problem is 
on this column:


Column('cod_caratteristica_rischio', Unicode(10), index=True, 
nullable=False)


It works fine in PostgreSQL but when I try it on Oracle sa tries to 
create an index with a name too long ( 30 char).



tbl['rischio_attivita'] = Table('rischio_attivita', database.metadata,
Column('id', Integer, Sequence('rischio_attivita_seq'), primary_key=True),
Column('cod_attivita', Unicode(10),nullable=False),
Column('cod_caratteristica_rischio', Unicode(10), index=True, 
nullable=False),

Column('tipo_calcolo', Integer),
Column('algoritmo', Unicode(200)),
Column('fattore_x', Float, PassiveDefault('1.0')),
ForeignKeyConstraint(['cod_attivita'], ['attivita.codice']),
ForeignKeyConstraint(['cod_caratteristica_rischio'], 
['caratteristica_rischio.codice'])

)


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-00972: identifier is 
too long
'CREATE INDEX ix_rischio_attivita_cod_caratteristica_rischio ON 
rischio_attivita (cod_caratteristica_rischio)' {}





Hi there, instead of creating the index as part of the Column
expression, use the Index[1] statement and assign a name yourself.

[1]
http://www.sqlalchemy.org/docs/reference/sqlalchemy/schema.html#sqlalchemy.schema.Index

  


--
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.