Gregg Lind wrote:
I use declarative base for defining classes.
I have a constraint that only works in Postgres. How do I declare
that constraint lowername_check only if the session is going
postgres (and not to sqlite, for example).
pg_only_constraint = CheckConstraint(lowername !~
As always, thank you for the complete, exhaustive answer. This
particular thing is definitely and edge case, and rather non-obvious,
so thank you for walking me through it.
Either of those are clean enough for me!
Is there are more proper / general way to describe the problem, so
google and
Gregg Lind wrote:
I used the DDL style
DDL('''ALTER TABLE data ADD CONSTRAINT lowername_check CHECK
(lowername !~ '[[\:upper\:]]')''',
on=postgres).execute_at('after-create',Data.__table__)
and now my print_schema method (based on
Alas, that doesn't seem to matter or help.
Even this statement causes the same issue. Odd. Must not be related
to the colons, alas.
DDL(r''' ''', on=postgres).execute_at('after-create',Data.__table__)
On Fri, May 29, 2009 at 3:08 PM, Michael Bayer mike...@zzzcomputing.com wrote:
Gregg
Gregg Lind wrote:
Alas, that doesn't seem to matter or help.
Even this statement causes the same issue. Odd. Must not be related
to the colons, alas.
DDL(r''' ''', on=postgres).execute_at('after-create',Data.__table__)
didnt realize you're printing with mock. its:
buf.write(str(s) +
mock is on the way out as a general use tool.
Gregg Lind wrote:
You got me there! Updating the FAQ on it would fix the issue for others.
For reference:
##
from sqlalchemy import *
from sqlalchemy.schema import DDL
from sqlalchemy.ext.declarative import