[sqlalchemy] server_default=text('1970-01-01 00:00:01') changed when run in a different timezone

2019-10-09 Thread Thomas Ryan
I have the following fields defined in a table. `updated` datetime NOT NULL DEFAULT '1970-01-01 00:00:01', `deleted` datetime NOT NULL DEFAULT '1970-01-01 00:00:01', When someone runs SQLACODEGEN it changes the definition of the server_default time based on the timezone the developer is in

[sqlalchemy] A query with many joins, and another query with PostgreSQL tsvector assignment

2018-07-04 Thread Thomas Levine
test (t tsvector); insert into test (t) values ( setweight(to_tsvector('english', 'Thomas Levine'), 'A') || setweight(to_tsvector('english', 'blah blah'), 'B') ); I would use it in the initialization of the Mail model from the same file as above. -- SQLAlchemy - The Python SQL

Re: [sqlalchemy] How can I filter (WHERE) on the results of a chained Selectable?

2017-01-02 Thread Thomas Vial
; actually I don't fancy too much hacking into the framework. I'll give a shot at CTEs, which I had overlooked in the docs. They're a good candidate as they give a "procedural" taste to SQL and this is exactly what I'm trying to do :-) Thanks a lot for the quick answer! Thomas Le 2 janv.

Re: [sqlalchemy] Query.delete() doesn't condition on polymorphic type

2016-09-12 Thread 'Thomas Gillam' via sqlalchemy
016, at 23:03, Mike Bayer <mike...@zzzcomputing.com> wrote: > > > > On 09/12/2016 05:30 PM, 'Thomas Gillam' via sqlalchemy wrote: >> Hello all, >> >> I ran into a problem today when running delete() on a query created on a >> derived polymorphic class. In a

[sqlalchemy] Query.delete() doesn't condition on polymorphic type

2016-09-12 Thread 'Thomas Gillam' via sqlalchemy
Hello all, I ran into a problem today when running delete() on a query created on a derived polymorphic class. In a nutshell, the SQL produced from the batch delete didn't condition on the polymorphic type, resulting in much broader deletion than was intended. I'm running SQLAlchemy 1.0.9.

[sqlalchemy] Python 3 and mysql

2015-04-05 Thread Thomas Tanner
Hello, which Python 3 compatible MySQL driver is recommended for SA? I couldn't find a single package which both installs cleanly with pip and passes the SA test suite. I've tried mysqlclient, mysqlconnector, cymysql, oursql on OSX. cheers, -- You received this message because you are

Re: [sqlalchemy] Unexpected return type of aggregate query.

2014-11-12 Thread Thomas Wanschik
, Thomas Wanschik twan...@googlemail.com javascript: wrote: Thanks for your answer. I did the exact same raw sql query (got the query string via echo=True) and it seems like mysql returned an integer (console print looked like a integer). So I concluded it has to be converted somewhere

[sqlalchemy] Unexpected return type of aggregate query.

2014-11-11 Thread Thomas Wanschik
Hi, the query session.query(func.sum(MyModel.amount)).scalar() with MyModel.amount = Column(SmallInteger, nullable=False) returns a Decimal instead of an integer when using mysql with the default driver (as well as with the cymysql driver). How can I get this query to return an integer? And

[sqlalchemy] Re: Unexpected return type of aggregate query.

2014-11-11 Thread Thomas Wanschik
:44 PM UTC+1, Thomas Wanschik wrote: Hi, the query session.query(func.sum(MyModel.amount)).scalar() with MyModel.amount = Column(SmallInteger, nullable=False) returns a Decimal instead of an integer when using mysql with the default driver (as well as with the cymysql driver). How

Re: [sqlalchemy] sqla on app engine?

2011-10-08 Thread Thomas G. Willis
you can run unittests against the sdk. there's a couple of setup things that have to be done though. I use the NoseGAE plugin for it. I don't think sql on gae is available in the sdk yet so there's not really much that can be done at the moment. When it does become available I'd be happy to

[sqlalchemy] Bug? Declarative syntax for double self-referential constructs with association object

2011-08-26 Thread Thomas Jacob
Hello List I'd like to define a many-to-many relationship using the declarative syntax between a table to itself, but employing an association object (since I require the association to have attributes also). Here's what I tried:

Re: [sqlalchemy] Bug? Declarative syntax for double self-referential constructs with association object

2011-08-26 Thread Thomas Jacob
, Thomas Jacob ja...@internet24.de wrote: Hello List I'd like to define a many-to-many relationship using the declarative syntax between a table to itself, but employing an association object (since I require the association to have attributes also). Here's what I tried

[sqlalchemy] label()

2010-04-08 Thread Thomas Heller
? This doesn't work: session.query(MyClass.label(spam)) -- Thanks, Thomas -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr

Re: [sqlalchemy] Re: String to Column Type Conversion

2009-11-23 Thread Thomas Burdick
This is exactly what I was looking for, thank you. Tom On Nov 23, 2009 12:42 PM, Conor conor.edward.da...@gmail.com wrote: Tom Burdick wrote: Ok, here's a small test. It actually works fine when using sqlite, but not wh... You can use sqlalchemy.cast() to coerce the type on the DB side:

[sqlalchemy] Re: custom order by

2009-11-02 Thread Thomas Drake
That was it. Thanks for the quick response! --~--~-~--~~~---~--~~ 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

[sqlalchemy] issue with group_concat and op

2009-10-29 Thread Thomas Drake
of parentheses? : group_concat((anon_2.status order by anon_2.stop)) Any ideas? Using the 'seperator' op instead of the 'order by' produces a similar error, and the group_concat works without the .op... Thanks, -thomas --~--~-~--~~~---~--~~ You received this message

[sqlalchemy] Re: issue with group_concat and op

2009-10-29 Thread Thomas Drake
Wow, my above example sucked. Here's something close to what I'm actually using: qs = ... qunion = qs[0].union_all(*qs[1:]).subquery() joined = session.query( KnownComponents.name, qunion, func.group_concat(qunion.c.status.op('order

[sqlalchemy] Re: issue with group_concat and op

2009-10-29 Thread Thomas Drake
Kickass! This is fantastic. Thanks! --~--~-~--~~~---~--~~ 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

[sqlalchemy] custom order by

2009-10-29 Thread Thomas Drake
Heyo, Is there any way to specify a particular ordering on a column with the order by clause (or otherwise)? Something like: session.query(People).order_by(People.name, ['rick', 'james', 'bob', 'mike']) Thanks, -thomas --~--~-~--~~~---~--~~ You received

[sqlalchemy] Re: web development with sqlalchemy

2009-10-21 Thread Thomas G. Willis
Sqlalchemy fits in nicely with pylons, turbogears 2, and repoze.bfg and I'm sure many others. So you have options. I wouldn't be able to offer any advice other than that, but spend a few moments getting familiar with each and you'll probably reach some conclusion. On Oct 21, 11:09 am, webdexter

[sqlalchemy] joined table inheritance + graph pattern

2009-10-02 Thread Thomas Drake
that I've tried using a polymorphic_union (for locating the value of the polymorphic_on and for primary and secondaryjoin in relations). That only yields sql code with multiple definitions of 'type'. Many thanks, -thomas --- from sqlalchemy import create_engine from sqlalchemy.ext.declarative import

[sqlalchemy] Re: joined table inheritance + graph pattern

2009-10-02 Thread Thomas Drake
On Oct 2, 3:41 pm, Michael Bayer mike...@zzzcomputing.com wrote: Thomas Drake wrote: primary = dep_groups.join(dep_group_components, dep_groups.c.group_id==dep_group_components.c.group_id).join (dependencies_table, dep_group_components.c.group_id==dependencies_table.c.parent_id

[sqlalchemy] Reading in single columns as numpy arrays

2009-06-05 Thread Thomas
trying to have an elaborate set of rules to figure out how to convert each column to its correct type, I thought there might be a robust way of doing this that just uses the existing column definition to figure out which numpy type to use? Thanks for any help, Thomas

[sqlalchemy] Numeric() type behavior

2009-04-13 Thread Thomas
column not be 300.156 since I specified scale=3? Am I doing something wrong? Thanks for any help, Thomas --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy

[sqlalchemy] Querying against the remote side of a ManyToMany

2008-09-17 Thread Alec Thomas
From the example here: http://www.sqlalchemy.org/docs/04/documentation.html#datamapping_manytomany How can i construct a query that will return the keywords for posts from a particular user? I'd expect this to work: session.query(Keyword).join(BlogPost.keywords) \

[sqlalchemy] Why don't dynamic_loader relations support order_by?

2008-03-09 Thread Thomas Wittek
Hi! I'm replacing some relation()s by dynamic_loader()s and encountered the problem that the order_by parameter doesn't work anymore. Obviously dynamic_loader doesn't support it. Is this left out with a special purpose? I'd find it quite useful to have a default ordering for the related

[sqlalchemy] Tiny feature request (+patch): Adding __len__ to orm.query.Query

2008-03-08 Thread Thomas Wittek
Hi! As I can also use several list operations on a Query instance (like access by index, slicing, ...) it might be a good idea to add __len__, so that I can use the pythonic len(query). The patch would be trivial (unless there are some internal issues that I don't know). Just add this method to

[sqlalchemy] How to do date calculations in a query and in relations?

2008-02-16 Thread Thomas Wittek
Hi! I'm trying to filter my data by some date calculations. In detail, I want to filter out messages that have been marked as deleted more than 30 days ago. In a query I could do it like this: threshold = datetime.now() - datetime.timedelta(30) return

[sqlalchemy] Using count on a relation without loading all related entities?

2007-11-19 Thread Thomas Wittek
If you want to count the children of a parent entity you can do it like that: parent.children.count(Child.id) Generally, this is fine. But it loads all children into the session and then manually counts them. For large sets this will become very slow. Wouldn't it be smarter to do the count

[sqlalchemy] Re: Bug (?) in combined 1:n:1 + m:n relation mapping

2007-10-17 Thread Thomas Wittek
On Oct 16, 7:42 pm, Michael Bayer [EMAIL PROTECTED] wrote: On Oct 16, 2007, at 1:30 PM, [EMAIL PROTECTED] wrote: Am I really supposed to save/flush/clear/query my objects to get the correct mappings? Or is this a bug? the advised pattern here is the association object pattern

[sqlalchemy] Re: Bug (?) in combined 1:n:1 + m:n relation mapping

2007-10-17 Thread Thomas Wittek
On Oct 17, 12:21 pm, Thomas Wittek [EMAIL PROTECTED] wrote: mapper(Participation, participation_table, properties=dict( user=relation(User, backref='participations') ) ) Should be: mapper(Participation, participation_table

[sqlalchemy] SQLError

2007-01-30 Thread Thomas Hunger
Hello, I was wondering if there is a special reason to wrap the db api exceptions like e.g. IntegrityError into an SQLError. The code could execute self._autorollback() and just rise the exception again. This would make much nicer exception handling (at least for me) in situations like