[sqlalchemy] Must close connection before drop_all?

2018-10-30 Thread T Johnson
Hi, I am writing some unit tests, and I am getting blocked waiting for a metadata lock (in MySQL) due to an open connection. The code is roughly: metadata.drop_all(engine) metadata.create_all(engine) conn = engine.connect() sql = sa.text('select * from table') rows =

[sqlalchemy] Syntax Error with Dialect kwargs

2017-04-05 Thread T Johnson
I have a script.py that does roughly this: import sqlalchemy as sa engine = ... part_text = """RANGE COLUMNS (my_date) ( PARTITION p20161017 VALUES LESS THAN ('2016-10-18'), PARTITION p20161018 VALUES LESS THAN ('2016-10-19'), PARTITION p1231 VALUES LESS THAN (MAXVALUE) )""" t

[sqlalchemy] bindparam vs %s

2016-11-10 Thread T Johnson
When I print a select statement, my bindparams show as %s instead of as named params. What could be the cause of this? >>> myparam BindParameter('myparamname', 'hello', type_=Unicode()) >>> print(table.c.colname == myparam) table.colname = :myparamname >>>

[sqlalchemy] Update join in core

2016-11-05 Thread T Johnson
How do I do an update join using SQLAlchemy core? In MySQL, it'd be something like this: update a left outer join b on a.x = b.x set a.y = 1 where b.x is null In other words, I want to modify a but only for the rows that do not exist in b according to my join criterion. The naive attempt that

[sqlalchemy] Associating select columns to original tables

2016-07-27 Thread T Johnson
Using base_columns() gets me pretty close but it doesnt indicate when a column has multiple base columns due to an equality join clause. It only returns a single base column for each column. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To

[sqlalchemy] Associating select columns to original tables

2016-07-27 Thread T Johnson
I am generating select queries that include alias tables, literal columns, renamed columns via label, multiple joins etc. The queries can be somewhat complex and as a debugging feature, I'd like be able to know which columns came from which tables...but I don't want to store this information

Re: [sqlalchemy] Update clause with alias name

2016-07-05 Thread T Johnson
Thanks, the blog post was very helpful. ClauseAdapter provided exactly what was needed. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to

[sqlalchemy] Update clause with alias name

2016-06-24 Thread T Johnson
I'm using SQLAlchemy Core. A user prepares an "on" expression for a join query and passes it to a function. The goal of the function is to hide some messy details the must be done to perform the join. Part of these details include doing a subselect. So in the implentation, the subselect is