[sqlalchemy] Oracle Express fails 0.5 ORM tutorial

2008-09-18 Thread Bruce Smith
Hello

I have Oracle Express Release 10.2.0.1.0, SQLAlchemy 0.4.5, Python 2.5.2 on
Ubuntu x86 8.04.

When I go through the ORM tutorial at
http://www.sqlalchemy.org/docs/04/ormtutorial.html it fails at the first
query below the heading *Saving Objects* with an Oracle ORA-01400 error as
follows:

sqlalchemy.exceptions.DatabaseError: (DatabaseError) ORA-01400: cannot
insert NULL into (BRUCE.USERS.ID)
 'INSERT INTO users (id, name, fullname, password) VALUES (:id, :name,
:fullname, :password)' {'fullname': 'Ed Jones', 'password': 'edspassword',
'name': 'ed', 'id': None}

My create_engine string was
 engine = sa.create_engine('oracle://bruce:[EMAIL PROTECTED]', echo=True)

The superficial reason for the error is obvious. Is this an Oracle
eccentricity? Is there a workaround?

Regards
Bruce

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Oracle Express fails 0.5 ORM tutorial

2008-09-18 Thread Bruce Smith
Thanks Michael, that works neatly.

- Bruce

On Fri, Sep 19, 2008 at 12:03 AM, Michael Bayer [EMAIL PROTECTED]wrote:


 On Sep 18, 2008, at 8:06 AM, Bruce Smith wrote:

 Hello

 I have Oracle Express Release 10.2.0.1.0, SQLAlchemy 0.4.5, Python 2.5.2 on
 Ubuntu x86 8.04.

 When I go through the ORM tutorial at
 http://www.sqlalchemy.org/docs/04/ormtutorial.html it fails at the first
 query below the heading *Saving Objects* with an Oracle ORA-01400 error as
 follows:

 sqlalchemy.exceptions.DatabaseError: (DatabaseError) ORA-01400: cannot
 insert NULL into (BRUCE.USERS.ID)
  'INSERT INTO users (id, name, fullname, password) VALUES (:id, :name,
 :fullname, :password)' {'fullname': 'Ed Jones', 'password': 'edspassword',
 'name': 'ed', 'id': None}

 My create_engine string was
  engine = sa.create_engine('oracle://bruce:[EMAIL PROTECTED]', echo=True)

 The superficial reason for the error is obvious. Is this an Oracle
 eccentricity? Is there a workaround?


 With Oracle, SQLA needs you to supply a Sequence for each column which
 you'd like to have autoincrementing behavior - the tutorial assumes all
 primary key columns are autoincrementing.SQLA will issue the CREATE
 SEQUENCE for you upon table.create(), but you need to just give it a name
 (the Oracle crowd, in my experience, appreciates no names of anything being
 guessed):

 Column('id', Integer, Sequence('mytable_id_seq'), primary_key=True)



 


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---