RE: [sqlalchemy] Possible bug with subqueryload

2011-09-28 Thread King Simon-NFHD78
-Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalchemy@googlegroups.com] On Behalf Of Michael Bayer Sent: 27 September 2011 19:37 To: sqlalchemy@googlegroups.com Subject: Re: [sqlalchemy] Possible bug with subqueryload On Sep 27, 2011, at 1:16 PM, King

[sqlalchemy] DropTable if exists

2011-09-28 Thread Chris Withers
Hi, Much less controversial question this time, I hope ;-) I have: class MyModel(Base) ... I want to do: engine = create_engine(...) engine.execute(DropTable(MyModel.__table__)) engine.execute(CreateTable(MyModel.__table__)) ...of course, this barfs the first time I run it as the table

Re: [sqlalchemy] delcarative with autoload when you have no connection

2011-09-28 Thread Chris Withers
On 27/09/2011 18:48, Michael Bayer wrote: (Note to readers: Chris and I hang out each year at Pycon. He's a great guy, so forgive the colloquial tone I take with him !) Likewise, I should point out I have huge amounts of respect for Mike, so if I'm grumbling, it's usually 'cos he's right

Re: [sqlalchemy] DropTable if exists

2011-09-28 Thread Michael Bayer
well the easiest is mytable.drop(engine, checkfirst=True). The check is not within the DropTable construct, which represents just the actual DROP TABLE statement.If you were using DropTable directly you'd call engine.has_table(tablename) first to check for it. On Sep 28, 2011, at 8:07

Re: [sqlalchemy] DropTable if exists

2011-09-28 Thread Chris Withers
On 28/09/2011 13:19, Michael Bayer wrote: well the easiest is mytable.drop(engine, checkfirst=True). The check is not within the DropTable construct, which represents just the actual DROP TABLE statement.If you were using DropTable directly you'd call engine.has_table(tablename) first to

Re: [sqlalchemy] DropTable if exists

2011-09-28 Thread Michael Bayer
On Sep 28, 2011, at 8:32 AM, Chris Withers wrote: On 28/09/2011 13:19, Michael Bayer wrote: well the easiest is mytable.drop(engine, checkfirst=True). The check is not within the DropTable construct, which represents just the actual DROP TABLE statement.If you were using DropTable

Re: [sqlalchemy] Possible bug with subqueryload

2011-09-28 Thread Michael Bayer
that mapper.order_by thing is fixed in 0.7.3/0.6.9 tip. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to

Re: [sqlalchemy] DropTable if exists

2011-09-28 Thread Chris Withers
On 28/09/2011 14:09, Michael Bayer wrote: Hmm, but both mysql and postgres (I suspect others do too, but I haven't checked) have DROP TABLE IF EXISTS statements so you don't need to do any checking. That feels like it should be supported by the DropTable construct, what am I missing? oh,

Re: [sqlalchemy] Possible bug with subqueryload

2011-09-28 Thread Simon King
On Wed, Sep 28, 2011 at 2:15 PM, Michael Bayer mike...@zzzcomputing.comwrote: that mapper.order_by thing is fixed in 0.7.3/0.6.9 tip. Brilliant - thanks again for all the time you put in to SA and this group, Simon -- You received this message because you are subscribed to the Google Groups

Re: [sqlalchemy] DropTable if exists

2011-09-28 Thread Michael Bayer
On Sep 28, 2011, at 9:47 AM, Chris Withers wrote: On 28/09/2011 14:09, Michael Bayer wrote: Hmm, but both mysql and postgres (I suspect others do too, but I haven't checked) have DROP TABLE IF EXISTS statements so you don't need to do any checking. That feels like it should be supported by

Re: [sqlalchemy] Validation of new objects before committing

2011-09-28 Thread Michael Bayer
On Sep 28, 2011, at 10:08 AM, Kirk Strauser wrote: I get what you're saying, truly, and agree with the underlying argument: SQLA is an ORM, not a data validator, template parser, or cheese grater. But I would contend that the kind of validations I'm proposing would operate on the level

[sqlalchemy] Re: Weird error using SQLAlchemy 0.7.2, MySQL, Python3, SqlSoup and relate

2011-09-28 Thread Ygor Lemos
I'm keeping a project that does pretty much the same as SQLSoup but also does automatic relationship and backref mapping. It also relies on the new Declarative Base and it doesn't rely on anything from SQLSoup, so when Soup gets discontinued, SQLasagna will go on :) You can see the code, fork

[sqlalchemy] Re: Validation of new objects before committing

2011-09-28 Thread Mengu
while we are on the subject, i'd like to ask a question if i'm doing it right or wrong. i have created a class called Validation with a method called is_valid and I have mixed it in my SQLAlchemy models. all of my models has an attribute called validation that consists of model's attributes that

Re: [sqlalchemy] Validation of new objects before committing

2011-09-28 Thread Kirk Strauser
On Sep 28, 2011, at 9:45 AM, Michael Bayer wrote: Also, there are type-based validations, fine, string, numeric, integer, dates, including length of strings. If someone throws on postgresql.INET, not really, unless the contract of TypeEngine objects is extended such that they *all* get

Re: [sqlalchemy] DropTable if exists

2011-09-28 Thread Mike Conley
On Wed, Sep 28, 2011 at 8:56 AM, Michael Bayer mike...@zzzcomputing.comwrote: On Sep 28, 2011, at 9:47 AM, Chris Withers wrote: On 28/09/2011 14:09, Michael Bayer wrote: I'm doing engine.execute('drop table if exists %s' + table.name) in the meantime, which just feels icky... oh