Re: [sqlalchemy] Can sqlalchemy help me solve this contraint issue?

2013-12-18 Thread Robert Betts
Jonathan, Michael Ignoring the debate on overloading a table to cater for multiple relationships, I think we are nearly back we we started i.e. a table where we would like to add an either or constraint. Other than database triggers or (before_flush, before_commit), is the a declarative

[sqlalchemy] How to declare a custom type that will imply a check on a column?

2013-12-18 Thread RonnyPfannschmidt
Hi, for supporting a certain schema requirement, i have to create a quite a number of columns that are checked not to be a empty string, So i'd like to declare a custom type, which will automatically imply the check on those columns. I already Investigated, how Boolean does this for databases

Re: [sqlalchemy] How to declare a custom type that will imply a check on a column?

2013-12-18 Thread Michael Bayer
On Dec 18, 2013, at 5:41 AM, RonnyPfannschmidt ronny.pfannschm...@gmail.com wrote: Hi, for supporting a certain schema requirement, i have to create a quite a number of columns that are checked not to be a empty string, So i'd like to declare a custom type, which will automatically

Re: [sqlalchemy] Can sqlalchemy help me solve this contraint issue?

2013-12-18 Thread Michael Bayer
On Dec 18, 2013, at 8:36 AM, Robert Betts robert.be...@navohpartners.com wrote: Jonathan, Michael Ignoring the debate on overloading a table to cater for multiple relationships, I think we are nearly back we we started i.e. a table where we would like to add an either or constraint.

Re: [sqlalchemy] Can sqlalchemy help me solve this contraint issue?

2013-12-18 Thread Robert Betts
Hi Michael Thank you, this is what I assumed! Rob On 18 Dec 2013, at 16:25, Michael Bayer mike...@zzzcomputing.com wrote: On Dec 18, 2013, at 8:36 AM, Robert Betts robert.be...@navohpartners.com wrote: Jonathan, Michael Ignoring the debate on overloading a table to cater for

Re: [sqlalchemy] How can I use the OVERLAPS operator?

2013-12-18 Thread Alex Grönholm
Ah, I was completely unaware of tuple_(). That's what I was looking for. Thanks! keskiviikko, 18. joulukuuta 2013 18.31.42 UTC+2 Michael Bayer kirjoitti: On Dec 17, 2013, at 8:39 PM, Alex Grönholm alex.g...@nextday.fijavascript: wrote: I would like to check if two date ranges overlap.

Re: [sqlalchemy] How can I use the OVERLAPS operator?

2013-12-18 Thread Michael Bayer
On Dec 17, 2013, at 8:39 PM, Alex Grönholm alex.gronh...@nextday.fi wrote: I would like to check if two date ranges overlap. This is done using the OVERLAPS operator. For example: SELECT (DATE '2001-02-16', DATE '2001-12-21') OVERLAPS (DATE '2001-10-30', DATE '2002-10-30'); How

Re: [sqlalchemy] How to declare a custom type that will imply a check on a column?

2013-12-18 Thread RonnyPfannschmidt
you’d use a TypeDecorator for this. See the example http://docs.sqlalchemy.org/en/rel_0_9/core/types.html#coercing-encoded-strings-to-unicodefor something similar (coerces to utf-8, just replace that with checking for non-empty). Unfortunately that doesn't quite fit, i need a DDL

Re: [sqlalchemy] How to declare a custom type that will imply a check on a column?

2013-12-18 Thread Michael Bayer
On Dec 18, 2013, at 3:05 PM, RonnyPfannschmidt ronny.pfannschm...@gmail.com wrote: you’d use a TypeDecorator for this. See the example http://docs.sqlalchemy.org/en/rel_0_9/core/types.html#coercing-encoded-strings-to-unicode for something similar (coerces to utf-8, just replace that

[sqlalchemy] Database locker error with sqlite in multi-process environment

2013-12-18 Thread AM
Hi All. I have a pyramid app, that uses sqlite via sqlalchemy when run in development. The configuration used: sqlalchemy.url = sqlite:///%(here)s/pyp.sqlite?pool_size=1 sqlalchemy.isolation_level = SERIALIZABLE The application initializes the engine using: settings =

[sqlalchemy] Re: Database locker error with sqlite in multi-process environment

2013-12-18 Thread AM
PS: The only thing I can think of that is not quite usual is that I have a save method on my models and that calls flush() on the session object. and the session is created using: DB = scoped_session(sessionmaker(extension=ZopeTransactionExtension())) Thanks. AM On 12/18/2013 09:35 PM,