On Tue, Jul 29, 2014 at 2:40 PM, Rich Shepard <[email protected]> wrote:
>   I'm starting to learn SQLAlchemy; have 0.9.7 installed on Slackware-14.1
> with Python-2.7.5, wxPython-3.0.0.0, and postgresql-9.3.4.
>
>   1)  In the docs I see a row constraint example using an integer comparison
> attrib.CheckConstraint('attrib>5'). What is the syntax for a list, such as
> this postgres example?
>
> CHECK (agency_name IN ('Federal', 'State', 'County', 'City', 'Local',
> 'Regional'),
>
>   Do I write agency_name.CheckConstraint('Federal', 'State', 'County',
> 'City', 'Local', 'Regional')?
>

Sorry, I don't know the answer to this, but based on the "attrib"
example, I would guess that the string is passed directly to the
database, so you would write something like:

agency_name.CheckConstraint("agency_name IN ('Federal', 'State',
'County', 'City', 'Local', 'Regional')")

>   2) I have searched the docs for instructions on how to specify a
> multi-column primary key, but have not found an example. The only references
> I find to multi-column keys are for foreign keys. My applicaton has several
> tables that require multi-column keys.
>

Specify the "primary_key=True" keyword argument for each column that
you want to form part of the primary key.

Hope that helps,

Simon

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to