Re: [sqlalchemy] Re: hierarchical data storage and searching

2010-09-09 Thread Chris Withers
On 08/09/2010 19:23, Gunnlaugur Briem wrote: http://communities.bmc.com/communities/docs/DOC-9902 Thanks for all of the references, but this one in particular. Materialized paths looks like its the closest to what I'm after. However, with materialized paths, I'm wondering with a structure

[sqlalchemy] SQL / SQLAlchemy'centric approach to problem

2010-09-09 Thread Warwick Prince
Hi All I'm new to SQLAlchemy (love it) and also new to SQL in general, although I have 25 years experience in a range of obscure databases. I have what I hope will be a simple question as I believe I'm missing a critical understanding of some of the underlying SQL machinery. This is the

Re: [sqlalchemy] Combining aliases with labels

2010-09-09 Thread Conor
On 09/08/2010 01:05 PM, Jack Kordas wrote: When I try to use both aliases and labels, the results are not named as expected. Instead of being able to access the columns as label-name_column- name it appears as original-table-name_numeric-sequence_column- name Thanks, Jack Sample code

Re: [sqlalchemy] Re: hierarchical data storage and searching

2010-09-09 Thread Conor
On 09/09/2010 02:18 AM, Chris Withers wrote: On 08/09/2010 19:23, Gunnlaugur Briem wrote: http://communities.bmc.com/communities/docs/DOC-9902 Thanks for all of the references, but this one in particular. Materialized paths looks like its the closest to what I'm after. However, with

Re: [sqlalchemy] Re: hierarchical data storage and searching

2010-09-09 Thread Chris Withers
Conor wrote: SELECT EXISTS (SELECT 1 FROM access_control WHERE (path = '/a' OR path LIKE '/a/%') AND user = :user AND permission = :permission) Most materialized path queries use LIKE a lot. As long as you keep the % character at the end, a good DB will be able to use an index to speed up

Re: [sqlalchemy] Copying instances from old to new schema DB

2010-09-09 Thread chaouche yacine
Thank you Michael, that's for the catch-the-error part. How about the set-relations-right part, if I decided to go with my fix-as-you go recipe ? do you have any idea ? the dictionary approach seems good, but I still am curious about how to set relations generically on models. I think I'll use

Re: [sqlalchemy] Copying instances from old to new schema DB

2010-09-09 Thread Michael Bayer
On Sep 9, 2010, at 11:31 AM, chaouche yacine wrote: Thank you Michael, that's for the catch-the-error part. How about the set-relations-right part, if I decided to go with my fix-as-you go recipe ? do you have any idea ? the dictionary approach seems good, but I still am curious about how

[sqlalchemy] SQLAlchemy / Turbogears2.0 transaction rollbacks

2010-09-09 Thread ozwyzard
Hello, I am trying to use Turbogears 2.x with SQLAlchemy 0.5.1. TG2 uses scoped sessions and uses an additional layer of transaction manager. If I have a scenario as follows: import transaction def main() try: add main_record to session query main_record to get primary key

Re: [sqlalchemy] SQLAlchemy / Turbogears2.0 transaction rollbacks

2010-09-09 Thread Michael Bayer
On Sep 9, 2010, at 3:51 PM, ozwyzard wrote: Hello, I am trying to use Turbogears 2.x with SQLAlchemy 0.5.1. TG2 uses scoped sessions and uses an additional layer of transaction manager. If I have a scenario as follows: import transaction def main() try: add main_record