[sqlalchemy] Re: checking in

2021-06-21 Thread 'Jonathan Vanasco' via sqlalchemy
> If not I wonder why messages aren't arriving in my INBOX. Check your settings for this group. If you do not see the option on the menu, try visiting https://groups.google.com/g/sqlalchemy/membership Google sometimes has a product change de-selects the email delivery option. Sometimes users

[sqlalchemy] Re: checking script validity

2013-08-29 Thread herzaso
Not quite related to sqlalchemy, but if you want a one-time check, check out sqlfiddle http://sqlfiddle.com/. On Friday, August 30, 2013 8:30:09 AM UTC+3, monosij...@gmail.com wrote: Hello - Not very familiar with sqlalchemy yet ... Is there a way to check if a script I have generated

[sqlalchemy] Re: Checking internals of query object

2010-08-27 Thread Bryan
I'm considering just checking for terms in the sql statement produced from str(query). That way I don't have to muddle with the internals of Query. However, I do introduce table and column names from the DB into my test code as strings, which of course defeats one of the reasons for using SA.

[sqlalchemy] Re: checking for C extensions at runtime

2010-07-18 Thread Michael Bayer
On Jul 16, 11:56 am, David Gardner dgard...@creatureshop.com wrote: I'm actually not sure, I did a bit of googling and couldn't really find much. Pep 386 talks about version comparison in distutils:http://www.python.org/dev/peps/pep-0386/#id10 As for scratching my itch it wouldn't have to

[sqlalchemy] Re: checking a relationship exists

2009-09-22 Thread joeformd
thanks - but how does that query specify a town? It seems like that would just return true if the current user had any town relationships? Or am I reading it wrong? On Sep 19, 5:46 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Sep 19, 2009, at 11:41 AM, joeformd wrote: When we

[sqlalchemy] Re: checking a relationship exists

2009-09-19 Thread joeformd
Thanks for the speedy response Michael, we came up with this: current_user_has_town = bool(session.query(User).filter (User.id==current_user.id).filter(User.towns.contains (current_user)).count()) which maybe has slightly clearer intent? --~--~-~--~~~---~--~~

[sqlalchemy] Re: checking a relationship exists

2009-09-19 Thread Michael Bayer
On Sep 19, 2009, at 10:19 AM, joeformd wrote: Thanks for the speedy response Michael, we came up with this: current_user_has_town = bool(session.query(User).filter (User.id==current_user.id).filter(User.towns.contains (current_user)).count()) which maybe has slightly clearer intent?

[sqlalchemy] Re: checking a relationship exists

2009-09-19 Thread joeformd
When we tried that it made a sql query to get all the towns (towns are loaded lazily) - that could be an awful lot of information, so this would be a much faster query On Sep 19, 4:33 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Sep 19, 2009, at 10:19 AM, joeformd wrote: Thanks for

[sqlalchemy] Re: checking a relationship exists

2009-09-19 Thread Michael Bayer
On Sep 19, 2009, at 11:41 AM, joeformd wrote: When we tried that it made a sql query to get all the towns (towns are loaded lazily) - that could be an awful lot of information, so this would be a much faster query so, the most succinct (and efficient) query of all is

[sqlalchemy] Re: checking a relationship exists

2009-09-18 Thread Michael Bayer
On Sep 18, 2009, at 7:44 PM, joeformd wrote: Is there a simple way in SQLA to check if a relationship exists between two rows in a many-to-many situation, where the relationship is defined using another table? eg. the join table might look like this: user_towns = Table('user_towns',

[sqlalchemy] Re: checking if a column is in a list

2009-01-21 Thread Michael Bayer
On Jan 21, 2009, at 7:46 PM, Jack Stahl wrote: Hello, I've got a few SQL interfaces where I'd like to change my query based on the columns required by the client. For example, in one situation, I only join against my User table if my client requires a photo id: # cols is the list

[sqlalchemy] Re: checking if a column is in a list

2009-01-21 Thread Jack Stahl
Thanks Michael! Properly was a poor choice of words on my part. Yes, of course, == is overloaded to make where (etc) clauses pretty, I just didn't put two and two together. --jack On Wed, Jan 21, 2009 at 5:38 PM, Michael Bayer mike...@zzzcomputing.comwrote: On Jan 21, 2009, at 7:46 PM, Jack

[sqlalchemy] Re: Checking active transactions

2008-02-22 Thread Michael Bayer
On Feb 22, 2008, at 5:29 AM, Christoph Zwerschke wrote: In TurboGears 1, requests are encapsulated between a session.begin() and session.commit() call (or session.rollback(), if there was an error). Starting with SA 0.4.3, the commit() raises an exception if the transaction has been

[sqlalchemy] Re: Checking active transactions

2008-02-22 Thread Christoph Zwerschke
Michael Bayer schrieb: thats fine...but also why cant you just say try: session.commit() except: session.rollback(); raise ? This would raise an error when the session is already inactive. I don't want an error in this case. On the other hand, if I remove the raise statement, then errors

[sqlalchemy] Re: checking the sql string.

2007-05-29 Thread Michael Bayer
On May 27, 2007, at 4:23 PM, SamDonaldson wrote: How do I look to see what sql is being constructed in the query object? So if I have something like: q = query.session(User) q = q.add_column() q = q.group_by(.).select() How do I check what sql string has been constructed in q?