Re: [sqlalchemy] EAV Optimizations

2013-05-13 Thread Michael Bayer
what video is that ?I don't use EAV's too often. If you can point me to something I can identify what it was. On May 13, 2013, at 8:22 PM, Lycovian wrote: > A few months ago I watched a video conference where Mike demo'd some > optimizations for SQLAlchemy when using EAV schemas. Does a

[sqlalchemy] EAV Optimizations

2013-05-13 Thread Lycovian
A few months ago I watched a video conference where Mike demo'd some optimizations for SQLAlchemy when using EAV schemas. Does anyone know if these optimizations will make it into the product that we have access to? I'm about to start a large EAV based project with SA and I was curious. Mike

Re: [sqlalchemy] textcolumn.contains() escaping, the lack of icontains(), and possible bug?

2013-05-13 Thread Daniel Grace
Good to hear! I took a look at #2694 and it seems that using column.contains(other, autoescape=True) might get wordy fairly quick when -- at least in new applications -- it would be a handy default. While it's probably not particularly feasible, it'd be handy if the default for autoescape cou

Re: [sqlalchemy] textcolumn.contains() escaping, the lack of icontains(), and possible bug?

2013-05-13 Thread Michael Bayer
On May 13, 2013, at 6:30 PM, Daniel Grace wrote: > So today I identified a small bug in my code and then, while trying to > resolve it, came to a few realizations: > > 1. column.contains(str) does not escape characters in str such as % and _. > Presumably, column.startswith(str) and column.e

[sqlalchemy] textcolumn.contains() escaping, the lack of icontains(), and possible bug?

2013-05-13 Thread Daniel Grace
So today I identified a small bug in my code and then, while trying to resolve it, came to a few realizations: 1. column.contains(str) does not escape characters in str such as % and _. Presumably, column.startswith(str) and column.endswith(str) have the same behavior. 2. There is a distinct

Re: [sqlalchemy] wiring in events as part of a declarative mixin

2013-05-13 Thread Michael Bayer
On May 13, 2013, at 3:28 AM, Chris Withers wrote: > Hi All, > > I'd like to wire in a listener for before_insert for all models that use a > particular mixin. I may need to construct the listener based on some columns > in both the mixin and the model that mixes it in. > > Do I use declared_

Re: [sqlalchemy] Possible regression from 0.7.9 to 0.8.0

2013-05-13 Thread Michael Bayer
this is a reopen of http://www.sqlalchemy.org/trac/ticket/2481, and is fixed again in r7699a1080742. Thanks for the report. On May 13, 2013, at 3:18 PM, Gerald Thibault wrote: > I have the following code: > > from sqlalchemy import * > from sqlalchemy.ext.declarative import declarative_base

Re: [sqlalchemy] order of operations question

2013-05-13 Thread Michael Bayer
On May 13, 2013, at 2:43 AM, Chris Withers wrote: > Hi All, > > If I do: > > obj = session.query(MyModel).one() > obj.attr = 'something' > session.add(MyModel(attr='else')) > session.commit() > > ...does sqlalchemy guarantee that the update will happen before the insert? that can't be guara

[sqlalchemy] Possible regression from 0.7.9 to 0.8.0

2013-05-13 Thread Gerald Thibault
I have the following code: from sqlalchemy import * from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import Session, relationship, backref e = create_engine('sqlite:tmp/test.db', echo=True) Base = declarative_base() Base.metadata = MetaData(e) class Node(Base):

Re: [sqlalchemy] ORM query with overlaps operator

2013-05-13 Thread gio
This solution seems to work in my context Thanks Gio Am Mittwoch, 8. Mai 2013 16:18:31 UTC+2 schrieb Michael Bayer: > > from sqlalchemy.sql import column, tuple_ > > a, b = column('a'), column('b') > > print tuple_(a, b).op("OVERLAPS")(tuple_(1, 2)) > > > "(a, b) OVERLAPS (:param_1, :param_2)"

[sqlalchemy] wiring in events as part of a declarative mixin

2013-05-13 Thread Chris Withers
Hi All, I'd like to wire in a listener for before_insert for all models that use a particular mixin. I may need to construct the listener based on some columns in both the mixin and the model that mixes it in. Do I use declared_attr and __declare_last__? Are there any examples around of doin

[sqlalchemy] order of operations question

2013-05-13 Thread Chris Withers
Hi All, If I do: obj = session.query(MyModel).one() obj.attr = 'something' session.add(MyModel(attr='else')) session.commit() ...does sqlalchemy guarantee that the update will happen before the insert? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting