[SQLObject] Re: Using foreign keys that end in FK
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Alan F. <ala...@gm...> - 2005-12-21 21:36:02
|
Il Tue, 20 Dec 2005 16:16:57 -0800, Brian Schlining ha scritto: > 1)The primary keys are BIGINT, not INT; I haven't tried it yet but is > this going to cause me problems? Are you using sqlmeta.fromDatabase=True or are you reimplementing the schema in sqlobject terms? > Is there any way to specify the name of the foreign key? I keep > thinking there should be something like this: > person = ForeignKey('Person', key = "PersonID_FK") I've never tried it with FKs, but it should work. Try this: Person = ForeignKey('Person',dbName='PersonID_FK') > Also, when using SQLObject to generate tables, is there anyway to > force it to use BIGINT instead of INT as the primary key type? I suppose you could do this (but it's untested, try it... i don't know how SQLO handles PK-override, it may need to specify Unique=True and alternateID=True as well): id=Col(sqlType='BIGINT') or maybe you don't need it at all, you're dealing with integers anyway, not with some string type... try not specifying anything as an ID and checking if it works with an ID larger than a 32bit number, if it doesn't get truncated and you don't get an overflow error either, you should be safe. -- Alan Franzoni <ala...@gm...> - Togli .xyz dalla mia email per contattarmi. To contact me, remove .xyz from my email address. - GPG Key Fingerprint: 5C77 9DC3 BD5B 3A28 E7BC 921A 0255 42AA FE06 8F3E |