[Sqlalchemy-users] UPDATE with subselects in WHERE

2006-04-27 Thread Dale Sedivec
Are you supposed to be able to use a sub-select in the WHERE clause of an UPDATE through SQLAlchemy? It generated this SQL for me: UPDATE passwords SET password=? WHERE passwords.user_id = SELECT users.id FROM users WHERE users.name = ? Note the lack of parenthesis around the

Re: [Sqlalchemy-users] session context proposal

2006-04-27 Thread Daniel Miller
Michael Bayer wrote: my current proposal regarding the association of objects to sessions, as well as the optional association of objects and classes to "session contexts", is as follows: ... Great! this looks pretty good. I do have a few comments on your other email though. Here goes...

Re: [Sqlalchemy-users] sqlite and DateTime types

2006-04-27 Thread Michael Bayer
OK, great. the docs are in fact missing something, but nothing to do with SQLite. they are missing the fact that the Date,Time, DateTime types all take datetime objects as arguments, not floats. and perhaps that the objects should have explicit checks for datetime types (although that wo

Re: [Sqlalchemy-users] sqlite and DateTime types

2006-04-27 Thread Jon Rosebaugh
On 4/27/06, Michael Bayer <[EMAIL PROTECTED]> wrote: > On Apr 27, 2006, at 6:15 PM, Jon Rosebaugh wrote: > > Yeah, that makes sense, I guess. I just expected SA to be able to read > > out what it itself had put into the database. > > > > it does. theres unit tests that pass. can you attach a test

Re: [Sqlalchemy-users] sqlite and DateTime types

2006-04-27 Thread Michael Bayer
On Apr 27, 2006, at 6:15 PM, Jon Rosebaugh wrote: On 4/27/06, Michael Bayer <[EMAIL PROTECTED]> wrote: there *is no date or time type* in SQLite: http://www.sqlite.org/ datatype3.html . so there is no expected format. if you use the Date/Time/DateTime type in SQLAlchemy, it will do reaonsa

Re: [Sqlalchemy-users] sqlite and DateTime types

2006-04-27 Thread Jon Rosebaugh
On 4/27/06, Michael Bayer <[EMAIL PROTECTED]> wrote: > there *is no date or time type* in SQLite: http://www.sqlite.org/ > datatype3.html . so there is no expected format. > > if you use the Date/Time/DateTime type in SQLAlchemy, it will do > reaonsable conversions between dates and strings, usi

Re: [Sqlalchemy-users] sqlite and DateTime types

2006-04-27 Thread Michael Bayer
On Apr 27, 2006, at 4:28 PM, Jon Rosebaugh wrote: On 4/27/06, William K. Volkman <[EMAIL PROTECTED]> wrote: I believe it's in the SQLite documentation that the database doesn't really concern itself with the data types that you specify. Basically it considers everything to be a string object

[Sqlalchemy-users] session context proposal

2006-04-27 Thread Michael Bayer
my current proposal regarding the association of objects to sessions, as well as the optional association of objects and classes to "session contexts", is as follows: Session - represents a current unit of work session and an associated collection of objects. a particular object is only i

Re: [Sqlalchemy-users] sqlite and DateTime types

2006-04-27 Thread Jonathan Ellis
On 4/27/06, Jon Rosebaugh <[EMAIL PROTECTED]> wrote: On 4/27/06, Jonathan Ellis <[EMAIL PROTECTED]> wrote:> It isn't SA's place to validate data for your database.  If you want a> database that's more rigorous about such things, then don't use sqlite. :) But SA _is_ validating the data. The problem

Re: [Sqlalchemy-users] sqlite and DateTime types

2006-04-27 Thread Jon Rosebaugh
On 4/27/06, Jonathan Ellis <[EMAIL PROTECTED]> wrote: > It isn't SA's place to validate data for your database. If you want a > database that's more rigorous about such things, then don't use sqlite. := ) But SA _is_ validating the data. The problem arises because SA is validating it in the DB->P

Re: [Sqlalchemy-users] sqlite and DateTime types

2006-04-27 Thread Jonathan Ellis
On 4/27/06, Jon Rosebaugh <[EMAIL PROTECTED]> wrote: On 4/27/06, William K. Volkman <[EMAIL PROTECTED]> wrote:> I believe it's in the SQLite documentation that the database> doesn't really concern itself with the data types that you > specify.  Basically it considers everything to be a string> obje

Re: [Sqlalchemy-users] sqlite and DateTime types

2006-04-27 Thread Jon Rosebaugh
On 4/27/06, William K. Volkman <[EMAIL PROTECTED]> wrote: > I believe it's in the SQLite documentation that the database > doesn't really concern itself with the data types that you > specify. Basically it considers everything to be a string > object for storage purposes. It's when you try to fet

Re: [Sqlalchemy-users] Polymorphism using MapperExtension can lead to multiple instances backed by the same data

2006-04-27 Thread Michael Bayer
alastair - the thing i am working on currently in 0.2 is: mapper(Person, people) mapper(Engineer, engineers, inherits=class_mapper(Person)) mapper(Manager, managers, inherits=class_mapper(Person)) people_mapper = mapper( Person, person_joi

Re: [Sqlalchemy-users] sqlite and DateTime types

2006-04-27 Thread William K. Volkman
On Wed, 2006-04-26 at 22:27, Jon Rosebaugh wrote: > On 4/26/06, Michael Bayer <[EMAIL PROTECTED]> wrote: > > why not use the DateTime type on your Column ? > > I did: > Column('timestamp', DateTime, nullable=3DFalse) > > It happily accepted seconds-since-the-epoch for storing into the > database,

[Sqlalchemy-users] Polymorphism using MapperExtension can lead to multiple instances backed by the same data

2006-04-27 Thread Alastair Houghton
Hi all, As is probably obvious from some of my previous posts, I'm trying to use a polymorphic mapper (via a MapperExtension). As is probably also obvious, there seem to be a few problems. Anyway, I think I've got to the bottom of one of them; in Michael's example "polymorph2.py", the M

Re: [Sqlalchemy-users] select and boolean fields

2006-04-27 Thread Gambit
Hey Jonathan, What is the SQL that those lines create? I've used the == False syntax myself a few times. What does your actual SA query look like in code? The best debugging trick I can offer for SA is to always run with all the debugging output on. This lets you see what SA thinks you're aski