Re: [sqlalchemy] alembic questions/comments

2013-05-31 Thread Chris Withers
On 30/05/2013 18:06, Colleen Ross wrote: What would be great would be to have .sql files and .sqli (mako templates with some context provided by the env.py) in addition to .py files. How hard could that be? ;-) UHHH Alembic *doesn't* support this?! Are you kidding me? Fuckit, I'm

[sqlalchemy] Recipe for text search across multiple fields

2013-05-31 Thread Paul Johnston
Hi, Often you want to offer the user a text box which will search through multiple fields. If the user is looking at the list of orders, they want a search box that will search: order id, customer name, product names, etc. I'm trying to put together a recipe for this, although it's becoming

[sqlalchemy] How to update PickleType column using DBSession.execute()

2013-05-31 Thread sajuptpm
How to update PickleType column using DBSession.execute() class MyTable(DeclarativeBase): __tablename__ = 'mytable' context = Column(PickleType) *Attempt 1 * context = {k1:{n1:bbla}, k2:{n2:bbla}} context = pickle.dumps(context) DBSession.execute(update mytable set

Re: [sqlalchemy] [Q][0.7.9] How to issue apply_labels() on an ORM query?

2013-05-31 Thread Ladislav Lenart
Glad I could help, but I don't understand what is going on. Neither ticket description nor the patch itself helped me. Sorry. What is select_from() good for when it generates a cartesian query? What MIGHT help ME (a lot infact) is a couple of DOs and DONTs examples in one place for all these

Re: [sqlalchemy] [Q][0.7.9] How to issue apply_labels() on an ORM query?

2013-05-31 Thread Ladislav Lenart
Hello. I've read the patch and the new documentation and i've learned about the existence of select_entity_from(). I was trying to say that the new documentation does not help me to understand the meaning / preferred usage of these constructs (i.e. select_from, select_entity_from and aliased). I

Re: [sqlalchemy] DISTINCT with LIMIT problem

2013-05-31 Thread Kent
Thanks very much! I got it to work apparently fine using from_self(). I didn't seem to need anything special for eager loads to continue to function... were you only expecting I'd have troubles with eager loads if I used subquery()? On 5/30/2013 6:29 PM, Michael Bayer wrote: On May 30,

Re: [sqlalchemy] How to update PickleType column using DBSession.execute()

2013-05-31 Thread Simon King
On Fri, May 31, 2013 at 10:28 AM, sajuptpm sajup...@gmail.com wrote: How to update PickleType column using DBSession.execute() class MyTable(DeclarativeBase): __tablename__ = 'mytable' context = Column(PickleType) Attempt 1 context = {k1:{n1:bbla}, k2:{n2:bbla}}

Re: [sqlalchemy] DISTINCT with LIMIT problem

2013-05-31 Thread Charlie Clark
Am 30.05.2013, 23:19 Uhr, schrieb Kent jkentbo...@gmail.com: For example, a query may look like this: select distinct count(*) over () as recordcount, tablea.colx, tableb.coly from tablea, tableb where limit 100 This doesn't *quite* work because the analytical window function

Re: [sqlalchemy] DISTINCT with LIMIT problem

2013-05-31 Thread Kent
I allow the user to join with other tables for the purpose of filtering (even though the joined tables won't be selected). Cartesian is probably the wrong term for the effect, but in the end, I get duplicate rows. I could get rid of the need for distinct by extensively using EXISTS clauses

Re: [sqlalchemy] [Q][0.7.9] How to issue apply_labels() on an ORM query?

2013-05-31 Thread Andrija Zarić
On Friday, May 31, 2013 11:46:46 AM UTC+2, Ladislav Lenart wrote: Glad I could help, but I don't understand what is going on. Neither ticket description nor the patch itself helped me. Sorry. What is select_from() good for when it generates a cartesian query? What MIGHT help ME (a lot

Re: [sqlalchemy] [Q][0.7.9] How to issue apply_labels() on an ORM query?

2013-05-31 Thread Andrija Zarić
On Fri, May 31, 2013 at 12:31 PM, Ladislav Lenart lenart...@volny.czwrote: Hello. I've read the patch and the new documentation and i've learned about the existence of select_entity_from(). I was trying to say that the new documentation does not help me to understand the meaning / preferred

Re: [sqlalchemy] Query and compiled_cache

2013-05-31 Thread Claudio Freire
On Thu, May 30, 2013 at 7:04 PM, Michael Bayer mike...@zzzcomputing.com wrote: The hashing thing really has to start as a core concept first. It's a big job but would be very helpful for caching scenarios and would allow us to build this feature on Query without too much difficulty. The

Re: [sqlalchemy] Query and compiled_cache

2013-05-31 Thread Michael Bayer
On Friday, May 31, 2013 10:18:41 AM UTC-4, Klauss wrote: On Thu, May 30, 2013 at 7:04 PM, Michael Bayer mik...@zzzcomputing.comjavascript: wrote: The hashing thing really has to start as a core concept first. It's a big job but would be very helpful for caching scenarios and

Re: [sqlalchemy] [Q][0.7.9] How to issue apply_labels() on an ORM query?

2013-05-31 Thread Michael Bayer
On Friday, May 31, 2013 6:31:25 AM UTC-4, Ladislav Lenart wrote: Hello. I've read the patch and the new documentation and i've learned about the existence of select_entity_from(). I was trying to say that the new documentation does not help me to understand the meaning / preferred usage

Re: [sqlalchemy] Recipe for text search across multiple fields

2013-05-31 Thread Michael Bayer
On May 31, 2013, at 5:06 AM, Paul Johnston paul@gmail.com wrote: Hi, Often you want to offer the user a text box which will search through multiple fields. If the user is looking at the list of orders, they want a search box that will search: order id, customer name, product names,

Re: [sqlalchemy] Query and compiled_cache

2013-05-31 Thread Claudio Freire
On Fri, May 31, 2013 at 11:29 AM, Michael Bayer mike...@zzzcomputing.com wrote: On Friday, May 31, 2013 10:18:41 AM UTC-4, Klauss wrote: On Thu, May 30, 2013 at 7:04 PM, Michael Bayer mik...@zzzcomputing.com wrote: The hashing thing really has to start as a core concept first. It's a

Re: [sqlalchemy] [Q][0.7.9] How to issue apply_labels() on an ORM query?

2013-05-31 Thread Ladislav Lenart
Thank you for the excellent description. The replace in bold did the trick for me :-) Ladislav Lenart On 31.5.2013 16:31, Michael Bayer wrote: On Friday, May 31, 2013 6:31:25 AM UTC-4, Ladislav Lenart wrote: Hello. I've read the patch and the new documentation and i've

Re: [sqlalchemy] Query and compiled_cache

2013-05-31 Thread Michael Bayer
On May 31, 2013, at 10:51 AM, Claudio Freire klaussfre...@gmail.com wrote: On Fri, May 31, 2013 at 11:29 AM, Michael Bayer mike...@zzzcomputing.com wrote: On Friday, May 31, 2013 10:18:41 AM UTC-4, Klauss wrote: On Thu, May 30, 2013 at 7:04 PM, Michael Bayer mik...@zzzcomputing.com

Re: [sqlalchemy] Query and compiled_cache

2013-05-31 Thread Claudio Freire
On Fri, May 31, 2013 at 12:46 PM, Michael Bayer mike...@zzzcomputing.com wrote: this hash works for backends that can render LIMIT as a bound parameter. It will *not* work for SQL server which cannot render LIMIT as a bound parameter. If the hash is determined at the level of Query, we *do

Re: [sqlalchemy] Query and compiled_cache

2013-05-31 Thread Michael Bayer
On May 31, 2013, at 11:59 AM, Claudio Freire klaussfre...@gmail.com wrote: On Fri, May 31, 2013 at 12:46 PM, Michael Bayer mike...@zzzcomputing.com wrote: this hash works for backends that can render LIMIT as a bound parameter. It will *not* work for SQL server which cannot render LIMIT as

[sqlalchemy] Inheritance, and tableless base class with relationship

2013-05-31 Thread developer . loke
Hi. I have the following structuring of classes with a base class without a table. User(base): address = relationship('Address', backref=backref(user, uselist=False)) address_id = Column(Integer) Address(base): __tablename__ = 'address' info = Column(String(255)) Info2 =

Re: [sqlalchemy] Inheritance, and tableless base class with relationship

2013-05-31 Thread Michael Bayer
On May 31, 2013, at 1:06 PM, developer.l...@gmail.com wrote: Hi. I have the following structuring of classes with a base class without a table. User(base): address = relationship('Address', backref=backref(user, uselist=False)) address_id = Column(Integer) Address(base):

Re: [sqlalchemy] Query and compiled_cache

2013-05-31 Thread Claudio Freire
On Thu, May 30, 2013 at 3:28 PM, Claudio Freire klaussfre...@gmail.com wrote: On Thu, May 30, 2013 at 2:25 PM, Michael Bayer mike...@zzzcomputing.com wrote: On May 30, 2013, at 11:25 AM, Claudio Freire klaussfre...@gmail.com wrote: That way, one could use the second form up there and benefit

Re: [sqlalchemy] Query and compiled_cache

2013-05-31 Thread Claudio Freire
On Fri, May 31, 2013 at 4:03 PM, Claudio Freire klaussfre...@gmail.comwrote: With: class CacheableQuery(sqlalchemy.orm.query.Query): def __init__(self, *p, **kw): self._cached_context = None self._cached_context_labels = None super(CacheableQuery, self).__init__(*p, **kw)

Re: [sqlalchemy] Query and compiled_cache

2013-05-31 Thread Michael Bayer
can you just attach a working .py script On May 31, 2013, at 3:06 PM, Claudio Freire klaussfre...@gmail.com wrote: On Fri, May 31, 2013 at 4:03 PM, Claudio Freire klaussfre...@gmail.com wrote: With: class CacheableQuery(sqlalchemy.orm.query.Query): def __init__(self, *p, **kw):

Re: [sqlalchemy] Query and compiled_cache

2013-05-31 Thread Claudio Freire
On Fri, May 31, 2013 at 4:44 PM, Michael Bayer mike...@zzzcomputing.comwrote: can you just attach a working .py script How does that work without a database? -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and

Re: [sqlalchemy] Recipe for text search across multiple fields

2013-05-31 Thread Paul Johnston
Hi, That's fixed it! I was so close :-) I was using mapper.order_by, which I'd hoped order_by(None) would cancel. No worries - it works now. This is in tw2.sqla DbListPage now, and I'll be putting updates in as I get round to it. Paul what's the purpose of cls.query.order_by(None) ?

Re: [sqlalchemy] Query and compiled_cache

2013-05-31 Thread Claudio Freire
On Fri, May 31, 2013 at 4:47 PM, Claudio Freire klaussfre...@gmail.comwrote: On Fri, May 31, 2013 at 4:44 PM, Michael Bayer mike...@zzzcomputing.comwrote: can you just attach a working .py script How does that work without a database? Ok, I took one of SQLA's tests, and make it break