[sqlalchemy] Re: transaction spanning multiple threads

2015-02-18 Thread Christian Lang
Hi Laurence, thanks for the reply. These are good pointers. Besides your suggested approach I am also trying something simpler as my use case is very specialized: 1) both Thread 1 and 2 write to completely different tables, 2) they are started both exactly after q2, 3) they (provably)

[sqlalchemy] transaction spanning multiple threads

2015-02-17 Thread Christian Lang
Hi, I have a question regarding multi-threading and transactions in the non-ORM case. Assume, we have a global Connection c (with transaction), on which a number of insert/update queries are executed and some insert/update queries are executed in threads: Main thread:

[sqlalchemy] creating a functional index for XML

2013-12-05 Thread Christian Lang
Hi, I'm trying to create the following index (on PostgreSQL) with SQLAlchemy 0.8: CREATE INDEX doc_idx ON xmltab (CAST((xpath('//@bla', doc))[1] AS TEXT)); (where doc is a column of type XML) I got this far: Index(doc_idx, cast((func.xpath('//@bla', xmlTable.c.doc))[1], TEXT)) but get the

Re: [sqlalchemy] creating a functional index for XML

2013-12-05 Thread Christian Lang
sqlalchemy import func, String from sqlalchemy.dialects import postgresql print func.xpath('something', 'somethingelse', type_=postgresql.ARRAY(String()))[1].compile(dialect=postgresql.dialect()) xpath(%(xpath_1)s, %(xpath_2)s)[%(xpath_3)s] On Dec 5, 2013, at 3:33 PM, Christian Lang christia

Re: [sqlalchemy] creating a functional index for XML

2013-12-05 Thread Christian Lang
://scott:tiger@localhost/test, echo=True) idx.create(e) the SQL itself still fails on PG (not familiar with the xpath function) but it renders: CREATE INDEX doc_idx ON xmltable (CAST(xpath('//@bla', doc)[1] AS TEXT)) On Dec 5, 2013, at 4:47 PM, Christian Lang christia...@gmail.comjavascript

Re: [sqlalchemy] creating a functional index for XML

2013-12-05 Thread Christian Lang
( '//@bla', xmlTable.c.doc, type_=postgresql.ARRAY(String()) ))[1], TEXT) ) On Dec 5, 2013, at 5:20 PM, Christian Lang christia...@gmail.comjavascript: wrote: I see, thanks for clarifying. I think