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 =
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
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
>>>
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
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
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
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
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