Am 30.06.2010 um 09:53 schrieb chaouche yacine:
--- On Tue, 6/29/10, Diez B. Roggisch <[email protected]> wrote:
What does the reflection of
the table say, if you say
psql > \d cities;
?
Diez
Hello,
Here's my psql session
(Sorry, french locales)
<psql>
testdb=> \d cities;
Table « public.cities »
Colonne | Type | Modificateurs
------------+-------------------
+---------------------------------------------------------
id | integer | non NULL Par défaut,
nextval('cities_id_seq'::regclass)
name | character varying |
country_id | integer |
Index :
"cities_pkey" PRIMARY KEY, btree (id)
"ix_cities_country_id" btree (country_id)
Contraintes de clés étrangères :
"cities_country_id_fk" FOREIGN KEY (country_id) REFERENCES
countries(id)
testdb=>
</psql>
It seems that the FK Constraint doesn't forbid Null values. I also
tried to put a nullable=False on the relation, but it seems to be an
unrecognized keyword argument. (Got : TypeError: __init__() got an
unexpected keyword argument 'nullable').
If I may cite myself:
"""
Add a "required=True" parameter to the ManyToOne-Country-declaration.
"""
And from my full listing:
class City(BaseModel):
"""
"""
using_options(tablename = "cities")
name = Field(Unicode)
country = ManyToOne("Country",ondelete="RESTRICT", required=True)
Diez
--
You received this message because you are subscribed to the Google Groups
"SQLElixir" 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/sqlelixir?hl=en.