Re: [SQLObject] Strange ForeignKey behavior...
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Oleg B. <ph...@ph...> - 2015-12-22 20:14:36
|
On Tue, Dec 22, 2015 at 02:19:12PM -0500, Nathan Edwards <nj...@ge...> wrote: > On 12/22/2015 1:28 PM, Oleg Broytman wrote: > > On Tue, Dec 22, 2015 at 12:50:09PM -0500, Nathan Edwards <nj...@ge...> wrote: > class B(SQLObject): > anInt = IntCol() > afk = ForeignKey("A") ... > # This succeeds and is inserted to sqlite database! > b = B(anInt=4,afk='Strange!') > > > He-he. Yes, that a wart but it's hard to fix. The PRIMARY KEY (id) > > column in a referenced table can be of string type[1] so ForeignKey > > allows both ints and strings (a ForeignKey doesn't know the type of the > > id column it points to). > > Hmmm. I thought this was probably the rationale. Not at all. ForeignKeys just don't do any validation or conversion. Would be worth fixing. > I'll see if I can figure out a minimalist patch to > propose... Eagerly waiting! But if you don't succeed notify me -- I'll at least add a TODO item. > Thanks, > > - n > > -- > Dr. Nathan Edwards nj...@ge... > Department of Biochemistry and Molecular & Cellular Biology > Georgetown University Medical Center > Room 1217, Harris Building, > 3300 Whitehaven St, NW, Washington DC 20007 > Phone: 202-687-7042, Fax: 202-687-0057 Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |