>> From what I've read of sqlalchemy, I originally wanted to have a main
>> table with one attribute foreign keyed to another table's
>> autoincremented integer primary key userId and a userName.  I thought
>> I could join the tables together and set that as the mapper.  The save
>> every object in my session.  I thought I had it all figured out until
>> I found out that specifically for sqlite, autoincrement (or
>> autogenerated primary keys) don't work with "composite" tables/using a
>> join.
>
> as long as the primary key of table #1 is a single-column primary key,
> SQLite autoincrements it.  To get the pk into your joined table, set the
> two columns to the same attribute.   e.g. as in
> http://www.sqlalchemy.org/docs/05/mappers.html#mapping-a-class-against-multiple-tables

Ah, I was going to reference another page, but I see you are the author.  Heh.

http://www.mail-archive.com/[email protected]/msg09503.html

Anyway, isn't this the same problem?  If I don't use foreign keys
pointing the main table to the user lookup, I get an error:

<class 'sqlalchemy.exceptions.ArgumentError'>: Can't find any foreign
key relationships between 'jobs' and 'users'

Maybe I'm explaining my problem wrong.

I have table A that has a few preassigned primary keys and
non-primary_key column 'userId', which references table B.
I have table B that has an autoincrementing primary key 'userId' and a
userName column is unique.  Based on the linked message you wrote
earlier, it seems like what you're now proposing isn't possible in
sqlite.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to