On Wed March 8 2006 16:48, Michael Bayer wrote:

> Oracle on the other hand doesnt have any "automatic primary key" type

> of feature, so the user is encouraged to make sequences for tables,

> but its definitely not needed (unless theres a bug im unaware of).

I think there is a bug out there. But I don't know enough about SA to locate it any better the included example works for sqlite, but oracle raises: "Column 'users.user_id': Oracle primary key columns require a default value or a schema.Sequence to create ids"

I've printed out the value of "plist" inside the pre_exec() call and the PK field has been sent in with a None value? From there I don't understand the call sequence so I haven't gotten any further. I did not that I can MAKE it work by altering the insert line to:

users.insert().execute(user_id=10,user_name='Rob',

email_address='[EMAIL PROTECTED]',password='secret')

Here's my test code.

from sqlalchemy import *

opts = {'echo':True}

#engine = create_engine('sqlite', {'filename':':memory:'}, **opts)

engine = create_engine('oracle', {'dsn':'mydsn',

'user':'myuser',

'password':'mypassword'}, **opts)

users = Table('users', engine,

Column('user_id', Integer, primary_key = True),

Column('user_name', String(16), nullable = False),

Column('email_address', String(60), key='email'),

Column('password', String(20), nullable = False)

)

users.create()

users.insert(values=(10,'Rob', '[EMAIL PROTECTED]','secret')).execute()

row = users.select().execute(user_name='Rob').fetchone()

print row

--

--------------------------------------------------------------

Robert E. Anderson email: [EMAIL PROTECTED]

Systems Programmer phone: (603) 862-3489

UNH Research Computing Center fax: (603) 862-1761

--------------------------------------------------------------

Reply via email to