[sqlalchemy] Re: query for many-to-many relation

2016-12-19 Thread Michal Nowikowski
= session.query(BlogPost.keyword_id).distinct().all() But how to do that for many-to-many relation? Regards, Michal On Monday, December 19, 2016 at 6:19:22 PM UTC+1, Jonathan Vanasco wrote: > > > > On Monday, December 19, 2016 at 11:26:31 AM UTC-5, Michal Nowikowski wrote: >>

[sqlalchemy] query for many-to-many relation

2016-12-19 Thread Michal Nowikowski
Hello, I have a problem with building a query where I'm using many-to-many relation. Let's take the example from tutorial: http://docs.sqlalchemy.org/en/latest/orm/tutorial.html#building-a-many-to-many-relationship Imagine that we have many Keywords but not all of them are used (not all are ass

[sqlalchemy] Re: postgresql, jsob and like operator

2015-12-01 Thread Michal Nowikowski
Great, it works. Thank you very much. Regards, Michal On Tuesday, December 1, 2015 at 6:49:05 PM UTC+1, Jonathan Vanasco wrote: > > I don't think you can get that exact query staying within the ORM's > cross-platform functionality -- I don't think there is anything that can > generate the `::`

[sqlalchemy] postgresql, jsob and like operator

2015-11-30 Thread Michal Nowikowski
Hello, I'm using Postgresql and JSONB column. I would like to write a query using ORM that will generate such SQL query: SELECT id,name,details FROM Device WHERE details::text LIKE '%99%'; where details is of JSONB type and it is converted to text and then like operator is used. Generally

Re: [sqlalchemy] mysql table partitioning in SA

2013-07-30 Thread Michal Nowikowski
nteger), > Column('amount', DECIMAL(7, 2)), > Column('tr_date', Date), > mysql_engine='InnoDB', > mysql_partition_by='HASH( MONTH(tr_date) )', > mysql_partitions='6' > )

[sqlalchemy] mysql table partitioning in SA

2013-07-26 Thread Michal Nowikowski
Hello, MySQL supports partitioning: http://dev.mysql.com/doc/refman/5.5/en/partitioning-overview.html It requires special CREATE TABLE statement. Is it possible to make use of this partitioning in SA? How to do this? Regards, Godfryd -- You received this message because you are subscribed to t

Re: [sqlalchemy] quoting problem

2013-05-08 Thread Michal Nowikowski
Thanks, SET sql_mode=ANSI_QUOTES; solved my problem. Regards, Godfryd On Wednesday, May 8, 2013 4:26:35 PM UTC+2, Michael Bayer wrote: > > > On May 8, 2013, at 12:33 AM, Michal Nowikowski > > > wrote: > > Hello, > > I'm using PostgreSQL and MySQL databas

[sqlalchemy] quoting problem

2013-05-07 Thread Michal Nowikowski
Hello, I'm using PostgreSQL and MySQL databases and unfortunately my table names are CamelCase. I have a problems with quoting in raw queries that it works for both dialects. 1. following query works in MySQL and fails in PostgreSQL: s = sqlalchemy.text('select max(version) from DatabaseSch

Re: [sqlalchemy] double outerjoin

2013-03-26 Thread Michal Nowikowski
q = q.outerjoin(b2, sqlalchemy.and_(A.id == b2.a_id, b2.c_id == 70)) q = q.filter(sqlalchemy.or_(b1.id != None, b2.id != None)) Regards, Godfryd On Monday, March 25, 2013 6:22:30 PM UTC+1, Michael Bayer wrote: > > > On Mar 25, 2013, at 1:54 AM, Michal Nowikowski > > &g

[sqlalchemy] double outerjoin

2013-03-24 Thread Michal Nowikowski
Hello, I need to do double outer join on following 2 tables A and B to get presented result using ORM query or SQL expressions. Table B should be outer joined twice to get joined 2 result sets (distinguished by c_id) that are for the same A records. Outer join is used to get NULLs where B re

[sqlalchemy] Re: not updated relation one-to-many

2007-07-27 Thread Michal Nowikowski
1' variables). It deliberately > doesn't update them. [cut] > You may also be interested in the refresh/expire methods of session: > > http://www.sqlalchemy.org/docs/unitofwork.html#unitofwork_api_refreshexpire Thanks. expire/refresh

[sqlalchemy] Re: not updated relation one-to-many

2007-07-27 Thread Michal Nowikowski
t1')}) > do check doco, just in case. Nope, it doesn't work :( In docs there is only about lazy parameter that should work for this but it does not :( Probably I misunderstood something. Regards Michal Nowikowski --~--~-~--~~~---~--~~ You received this

[sqlalchemy] not updated relation one-to-many

2007-07-27 Thread Michal Nowikowski
ery for first row in t1, I see one element in collection t2s - it is ok. Then when I add second row to t2, the collection in t1 object is not updated. It still contains only one element. Example below. Could you tell me how to refresh collection in one-to-many relation??? Regards Michal Nowik