Re: [sqlalchemy] filter like using a string in a column of timestamps without time zones - postgres

2018-09-11 Thread George Brande
Thank you! You eliberated me to finally move to the next step in my project, this kept me at a standstill. Thank you ! marți, 11 septembrie 2018, 12:59:18 UTC+3, Simon King a scris: > > On Tue, Sep 11, 2018 at 9:39 AM George Brande > wrote: > > > > Hello. > > > > My angular is using a

Re: [sqlalchemy] filter like using a string in a column of timestamps without time zones - postgres

2018-09-11 Thread Simon King
On Tue, Sep 11, 2018 at 9:39 AM George Brande wrote: > > Hello. > > My angular is using a datepicker to send a date in string format(ex: > 2018-09-11) to my flask app to postgres via sqlalchemy. > In my postgres all rows have a column ef_time of timestamps type.(ex: > 2018-09-07 13:24:30.138) >

[sqlalchemy] filter like using a string in a column of timestamps without time zones - postgres

2018-09-11 Thread George Brande
Hello. My angular is using a datepicker to send a date in string format(ex: 2018-09-11) to my flask app to postgres via sqlalchemy. In my postgres all rows have a column ef_time of timestamps type.(ex: 2018-09-07 13:24:30.138) @app.route('/orders/') def get_orders(ide): session = Session()

Re: [sqlalchemy] Looks like there is no event to catch "before" a rollback happens

2017-03-11 Thread mike bayer
On 03/11/2017 10:15 AM, mike bayer wrote: On 03/10/2017 11:12 AM, Alessandro Molina wrote: On Fri, Mar 10, 2017 at 3:40 PM, mike bayer > wrote: If this is truly, "unexpected error but we need to do things", perhaps you

Re: [sqlalchemy] Looks like there is no event to catch "before" a rollback happens

2017-03-11 Thread mike bayer
On 03/10/2017 11:12 AM, Alessandro Molina wrote: On Fri, Mar 10, 2017 at 3:40 PM, mike bayer > wrote: If this is truly, "unexpected error but we need to do things", perhaps you can use before_flush() to memoize the details

Re: [sqlalchemy] Looks like there is no event to catch "before" a rollback happens

2017-03-10 Thread Simon King
On Fri, Mar 10, 2017 at 4:12 PM, Alessandro Molina wrote: > > > On Fri, Mar 10, 2017 at 3:40 PM, mike bayer > wrote: >> >> If this is truly, "unexpected error but we need to do things", perhaps you >> can use before_flush() to memoize the

Re: [sqlalchemy] Looks like there is no event to catch "before" a rollback happens

2017-03-10 Thread Alessandro Molina
On Fri, Mar 10, 2017 at 3:40 PM, mike bayer wrote: > If this is truly, "unexpected error but we need to do things", perhaps you > can use before_flush() to memoize the details you need for a restore inside > of session.info. > > An event hook can be added but it would

Re: [sqlalchemy] Looks like there is no event to catch "before" a rollback happens

2017-03-10 Thread mike bayer
On 03/10/2017 01:57 AM, Alessandro Molina wrote: I have been looking for a way to know what's going to be rolled back in SQLAlchemy so that I can know what was changed and restore other database unrelated things to their previous state. By

[sqlalchemy] Looks like there is no event to catch "before" a rollback happens

2017-03-09 Thread Alessandro Molina
I have been looking for a way to know what's going to be rolled back in SQLAlchemy so that I can know what was changed and restore other database unrelated things to their previous state. By http://docs.sqlalchemy.org/en/latest/orm/events.html#session-events it looks like it's available an

[sqlalchemy] virtual-like entities, concrete table inheritance

2013-05-22 Thread Julien Cigar
Hello, I'm currently implementing a RBAC-like model for a webapp with the usual suspects: users, roles, permissions, etc where a Role has one or more Permissions, and an User can be in 1 or more Role. I would like to some virtual-like Role that are automatically attribued in some

Re: [sqlalchemy] virtual-like entities, concrete table inheritance

2013-05-22 Thread Michael Bayer
On May 22, 2013, at 7:14 AM, Julien Cigar jci...@ulb.ac.be wrote: Hello, I'm currently implementing a RBAC-like model for a webapp with the usual suspects: users, roles, permissions, etc where a Role has one or more Permissions, and an User can be in 1 or more Role. I would like to

Re: [sqlalchemy] NOT LIKE

2012-08-23 Thread Michael Bayer
On Aug 22, 2012, at 11:38 PM, Warwick Prince wrote: Thanks Michael I struggle sometimes to find examples of the simple things, so eventually searched out the like_op as it was in the same place as eq() etc. So, on that subject - is it better to use query.where(eq(a, b)) or

Re: [sqlalchemy] NOT LIKE

2012-08-23 Thread Warwick Prince
OK - cool. I had looked at the first ORM tutorial, but I guess I had glossed over it, as it was talking about session.query, and I believed I was looking for something lower level than that for the direct table.select. Obviously not. :-) Makes sense that it would all follow suit, but I was

[sqlalchemy] NOT LIKE

2012-08-22 Thread Warwick Prince
Hi When creating a basic query, how does one code a NOT LIKE using SA? I can do this; query = table.select().where(like_op(table.c.name, 'fred%')) I can not find a NOT LIKE operator. The ones there notlike_op and notilike_op raise NotImplemented. I've placed it in as text('%s NOT LIKE %s')

Re: [sqlalchemy] NOT LIKE

2012-08-22 Thread Michael Bayer
not sure why the like_op and nolike_op have come into your normal vocabulary here as they are usually just the ops used internally. LIKE is column.like(other) and NOT LIKE is ~column.like(other). On Aug 22, 2012, at 9:15 PM, Warwick Prince wrote: Hi When creating a basic query, how does

Re: [sqlalchemy] NOT LIKE

2012-08-22 Thread Warwick Prince
Thanks Michael I struggle sometimes to find examples of the simple things, so eventually searched out the like_op as it was in the same place as eq() etc. So, on that subject - is it better to use query.where(eq(a, b)) or query.where(a==b), or does it make no difference really? not sure

[sqlalchemy] Select like but the other way around

2011-11-07 Thread Paul
I'm trying to do a like statement in a query filter. I'm fine doing it one way for instance session.query(Table).filter(Table.path.like(C:\Test\%)) which would hopefully return all folders and files in the folder Test but what if I want to do it the other way around and pass

Re: [sqlalchemy] Select like but the other way around

2011-11-07 Thread Michael Bayer
sure it does, if you convert it to a SQL token first: literal(C:\test\testfile.txt).like(Table.path + %) or even literal(C:\test\testfile.txt).startswith(Table.path) On Nov 7, 2011, at 8:40 AM, Paul wrote: I'm trying to do a like statement in a query filter. I'm fine doing it one way for

[sqlalchemy] Django-like test fixtures via SQLAlchemy?

2011-03-11 Thread Todd Rowell
Hi All- I'm a long-time Django user who has become accustomed to Django's easy generation and loading of test fixtures (i.e., a known database state for testing) and I'm looking for something similar for SQLAlchemy. I've seen and been working with Kumar's fixture project (http://

Re: [sqlalchemy] Django-like test fixtures via SQLAlchemy?

2011-03-11 Thread Michael Bayer
On Mar 11, 2011, at 2:25 PM, Todd Rowell wrote: Hi All- I'm a long-time Django user who has become accustomed to Django's easy generation and loading of test fixtures (i.e., a known database state for testing) and I'm looking for something similar for SQLAlchemy. I've seen and been

[sqlalchemy] Something like orderinglist for secondary tables?

2010-11-18 Thread Torsten Landschoff
Hi *, I am fighting half a day with something I expected to be trivial: Keep the order of items in a collection implemented vi a secondary table (many-to-many relationship). Basically, I have a Collection class with a relationship to Items in the collection. That relationship is configured via

Re: [sqlalchemy] Something like orderinglist for secondary tables?

2010-11-18 Thread Michael Bayer
On Nov 18, 2010, at 9:32 AM, Torsten Landschoff wrote: Hi *, I am fighting half a day with something I expected to be trivial: Keep the order of items in a collection implemented vi a secondary table (many-to-many relationship). Basically, I have a Collection class with a relationship

Re: [sqlalchemy] Something like orderinglist for secondary tables?

2010-11-18 Thread Torsten Landschoff
Hi Michael, Thanks for your lightning fast reply! On Thu, 2010-11-18 at 10:17 -0500, Michael Bayer wrote: this is correct. The functionality provided by secondary is that SQLA will maintain a table with foreign keys to the related primary keys on either side. It does not do anything at

Re: [sqlalchemy] Something like orderinglist for secondary tables?

2010-11-18 Thread Michael Bayer
On Nov 18, 2010, at 11:01 AM, Torsten Landschoff wrote: Hi Michael, Thanks for your lightning fast reply! On Thu, 2010-11-18 at 10:17 -0500, Michael Bayer wrote: this is correct. The functionality provided by secondary is that SQLA will maintain a table with foreign keys to the

[sqlalchemy] looks like bug ses.query(data).update()

2010-09-30 Thread bogun . dmitriy
I try to update counter for omr object ang got following: Traceback (most recent call last): File /home/vugluskr/tmp/z/sa.py, line 56, in module main() File /home/vugluskr/tmp/z/sa.py, line 52, in main q2.update({data.cnt: data.cnt + 1}) File

Re: [sqlalchemy] looks like bug ses.query(data).update()

2010-09-30 Thread Michael Bayer
this is a bug , created at http://www.sqlalchemy.org/trac/ticket/1935 , and a patch which fixes this issue is there. will try to get this committed soon. On Sep 30, 2010, at 9:57 AM, bogun.dmit...@gmail.com wrote: I try to update counter for omr object ang got following: Traceback

Re: [sqlalchemy] looks like bug ses.query(data).update()

2010-09-30 Thread bogun . dmitriy
2010/9/30 Michael Bayer mike...@zzzcomputing.com: this is a bug , created at http://www.sqlalchemy.org/trac/ticket/1935 , and a patch which fixes this issue is there.     will try to get this committed soon. Thanks, patch fix issue. I try to update counter for omr object ang got following:

[sqlalchemy] dictionary-like objects for ORM

2010-08-18 Thread yota
Hello, sqlalchemy seems to be the proper tool for my needs but I can't figure out how to design my project or set the ORM properly. Let's say, I build a music database, storing tracks and their associated metadata in an sql-like database defined as such : TRACK_TABLE ( ident *, url , duration )

Re: [sqlalchemy] dictionary-like objects for ORM

2010-08-18 Thread Conor
On 08/17/2010 11:32 AM, yota wrote: Hello, sqlalchemy seems to be the proper tool for my needs but I can't figure out how to design my project or set the ORM properly. Let's say, I build a music database, storing tracks and their associated metadata in an sql-like database defined as such :

[sqlalchemy] Strange LIKE behavior with TypeDecorator

2009-09-18 Thread Mike Orr
I have the following TypeDecorator type to store a tuple of strings as a delimited string. It works fine but I discovered an abnormality with LIKE. The right side of a like expression is being passed to the converter, so it has to be a one-item tuple instead of a string. This makes my model

[sqlalchemy] django like inspectdb

2009-08-06 Thread dusans
is there something similar to inspectdb in sqlalchemy where it returns orm classes for tables already in the db? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to

[sqlalchemy] pretend like an object was loaded, not created

2009-01-21 Thread qvx
I have a web application which is accessed from different sub-domains. Each sub-domain corresponds to one row/object in installation table. I am fetching this one row/object on every request which is unnecessary. My question is: how can I fetch this object only once and somehow stuff it inside a

[sqlalchemy] Re: LIKE filter and psycopg2

2008-11-12 Thread Michael Bayer
On Nov 12, 2008, at 12:14 PM, Steve Howe wrote: Hello all, I'm having trouble using SQLAlchemy 0.50.rc3 and like query filters with the psycopg2 adapter: class Activity(Base): __tablename__ = 'activities' id = Column(Integer, primary_key=True, autoincrement=True) name =

[sqlalchemy] Re: LIKE filter and psycopg2

2008-11-12 Thread Steve Howe
Hello Michael, its not clear to me what is actually going wrong in that case. does it work if you use a raw psycopg2 script ? Yes it does, however I figured out the print statement from the other block was just printing what would be sent to the adapter and not to the database - that

[sqlalchemy] Re: LIKE doesn't work in direct SQL queries

2008-05-14 Thread Michael Bayer
try two percent signs to escape it - %%. On May 14, 2008, at 10:50 AM, Artur Siekielski wrote: Hi. I want to execute ready SQL query using SA's engine: engine.execute(r''' SELECT * FROM City WHERE name LIKE 'a%' ''') I get this strange error:

[sqlalchemy] Re: LIKE doesn't work in direct SQL queries

2008-05-14 Thread Artur Siekielski
It works :). Ah, I was sure I have tried it :). Thanks for fast reply. On 14 Maj, 18:42, Michael Bayer [EMAIL PROTECTED] wrote: try two percent signs to escape it - %%. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

[sqlalchemy] SQLAlchemy: like and security (sql injection attacks)

2007-09-20 Thread Felix Schwarz
Hi, I have a question related to sql injection when using a clause like this: User.c.username.like('%' + userinput + '%') What restrictions do I have to put on the variable userinput? Of course, I will ensure that is no percent character ('%') in userinput. Is that enough (assuming that

[sqlalchemy] Re: like doesn't work with objects

2007-06-06 Thread Techniq
On Jun 6, 12:37 am, Mike Orr [EMAIL PROTECTED] wrote: On 6/5/07, Techniq [EMAIL PROTECTED] wrote: I'm going through the wiki cookbook http://docs.pythonweb.org/display/pylonscookbook/SQLAlchemy+for+peopl... and I'm discovering that even though 'model.class.c.column_name.like' is

[sqlalchemy] Re: like doesn't work with objects

2007-06-05 Thread Mike Orr
On 6/5/07, Techniq [EMAIL PROTECTED] wrote: I'm going through the wiki cookbook http://docs.pythonweb.org/display/pylonscookbook/SQLAlchemy+for+people+in+a+hurry and I'm discovering that even though 'model.class.c.column_name.like' is available it doesn't perform a LIKE in the query. from