Yes indeed - it has been fixed in 0.4 beta 3. I think I'll just switch
to 0.4 now before I've done too much coding with 0.3
Thanks again Michael
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
T
Hi. I'm not sure if this is a known bug or whether I'm doing something
obviously wrong.
Using Oracle 10g, say I've got a pre-existing table something like
this:
create table testing (
userid NUMBER PRIMARY KEY,
is_active VARCHAR2(1) DEFAULT 'N'
);
when I try to autoload with sa 0.3.10
>
> you should be able to say:
>
> table = Table('account_stuff', metadata,
>Column('account_id', Integer, ForeignKey('account_ids.account_id'),
> primary_key=True),
>autoload=True)
>
That doesn't appear to work unfortunately. When I load the db and
create the two tables and then attempt
>
> whys that ? theres no reason you can't set both on the column.
Ah, my mistake. I kind of assumed a column couldn't be both a foreign
key and a primary key. I'd also tried autoloading the table and then
specifying that the column was a primary key using:
account_stuff_table = Table('accoun
>
> just place the "primary_key=True" attribute on your Column. since
> its an existing table in your oracle database, you arent creating the
> table there so nothing changes.
Ah yeah. That works. Obviously I lose the foreign key relationship
with account_ids which is a bit of a shame.
It'd be
>
> one interesting thing here is that i think you've found the oldest
> bug in SQLAlchemy ever. so thats fixed in the trunk / 0.3 branch,
> the bug being that it was trying to issue an UPDATE on a table which
> has no primary keys.
Glad to be of service :-)
> now, if theres a reason you can't
ac.credit = 10
session.flush()
When the flush executes I get the error:
: Updated
rowcount 2 does not match number of objects updated 1
because it's trying to execute the sql: UPDATE account_stuff SET
credit=?
because I assume account_stuff has no pri