Re: [sqlalchemy] orm.column_property()

2023-06-23 Thread Julien Cigar
me I'll use https://github.com/sqlalchemy/sqlalchemy/discussions Thanks! Julien > > > On Fri, Jun 23, 2023, at 4:48 AM, Julien Cigar wrote: > > On Wed, Jun 21, 2023 at 08:35:36AM -0400, Mike Bayer wrote: > >> > >> > >> > >> On Wed, Jun 21, 20

Re: [sqlalchemy] orm.column_property()

2023-06-23 Thread Julien Cigar
On Fri, Jun 23, 2023 at 10:48:27AM +0200, Julien Cigar wrote: > > On Wed, Jun 21, 2023 at 08:35:36AM -0400, Mike Bayer wrote: > > > > > > > > On Wed, Jun 21, 2023, at 5:12 AM, Julien Cigar wrote: > > > Hello, > > > > > > I'm trying to

Re: [sqlalchemy] orm.column_property()

2023-06-23 Thread Julien Cigar
On Wed, Jun 21, 2023 at 08:35:36AM -0400, Mike Bayer wrote: > > > > On Wed, Jun 21, 2023, at 5:12 AM, Julien Cigar wrote: > > Hello, > > > > I'm trying to add a column_property to recursively load and merge some > > json column. > > > > I

[sqlalchemy] orm.column_property()

2023-06-21 Thread Julien Cigar
rrent" involved objet..? For example when I'm doing dbsession.get(MyClass, 1234) I cannot figure how reference the id in the column_property query Any idea ? Thanks! -- Julien Cigar Belgian Biodiversity Platform (http://www.biodiversity.be) PGP fingerprint: EEF9 F697 4B68 D275 7B11 6A25 B2BB

Re: [sqlalchemy] migrating to 1.4 and sql.and_()

2021-06-22 Thread Julien Cigar
Have a nice day, Julien > > - mike > > > > On Mon, Jun 21, 2021, at 5:25 AM, Julien Cigar wrote: > > ok .. :) > > > > Another regression from 1.3: I have two deferred column_property on my > > mapped class (1) and with

Re: [sqlalchemy] migrating to 1.4 and sql.and_()

2021-06-21 Thread Julien Cigar
0400, Mike Bayer wrote: > > that's a really obscure API you found there. Coverage for that wasn't > carried along to 1.4 unfortunately so you'd need to assemble that list > outside of the and_() first for now. > > > On Fri, Jun 18, 2021, at 4:08 AM, Julien Cigar w

Re: [sqlalchemy] migrating to 1.4 and sql.and_()

2021-06-18 Thread Julien Cigar
On Fri, Jun 18, 2021 at 10:08:04AM +0200, Julien Cigar wrote: > Hello, > > While updating SQLAlchemy dependency to 1.4 (from 1.3) I noticed that I > couldn't use .append() on an existing sql.and_() clause .. is it > expected..? I forgot to add that the error I get is: Traceba

[sqlalchemy] migrating to 1.4 and sql.and_()

2021-06-18 Thread Julien Cigar
: https://gist.github.com/silenius/2054e7dc690946c0122c72e6b05f1433 Thanks, Julien -- Julien Cigar Belgian Biodiversity Platform (http://www.biodiversity.be) PGP fingerprint: EEF9 F697 4B68 D275 7B11 6A25 B2BB 3710 A204 23C0 No trees were killed in the creation of this message. However, many

Re: [sqlalchemy] issue with hybrid properties

2021-06-16 Thread Julien Cigar
foo = orm.aliased(cls.document_current_translation) > # q = sql.select([getattr(foo, name)]).as_scalar() > # return q > > log.info("Adding hybrid attribute: %s.%s", cls, name) > > prop = hybrid_property(fget=_fget, fset=_fset, expr=_expr)

Re: [sqlalchemy] issue with hybrid properties

2021-06-14 Thread Julien Cigar
d I subselect from this row-limited current_translation relationship in my hybrid property expression ..) Have a good day, Julien > > On Tue, Jun 1, 2021, at 6:58 AM, Julien Cigar wrote: > > On Fri, May 28, 2021 at 10:53:26AM -0400, Mike Bayer wrote: > > > the hybri

Re: [sqlalchemy] issue with hybrid properties

2021-06-02 Thread Julien Cigar
t_translation.language_id AND > content_translation.content_id = document_translation.content_id > > I know you've had this model working for many years now. > > > > > > > On Fri, May 28, 2021, at 8:25 AM, Julien Cigar wrote: > > Hello, > > >

Re: [sqlalchemy] issue with hybrid properties

2021-06-02 Thread Julien Cigar
tion.content_id > > I know you've had this model working for many years now. > > > > > > > On Fri, May 28, 2021, at 8:25 AM, Julien Cigar wrote: > > Hello, > > > > I have a project heavily based on joinedload inheritance. It's a > > CMS-

[sqlalchemy] issue with hybrid properties

2021-05-28 Thread Julien Cigar
s joinedload) SQLAlchemy adds the base ContentTranslation class. I've also tried with .join() manually and add it with orm.contains_eager() but it doesn't work either.. I've made a full POC on https://gist.github.com/silenius/77466fc260a9cb0f25025bffbf3339cd Any idea ? :) Thanks, Julien

Re: [sqlalchemy] jsonb_agg with an InstrumentedAttribute

2020-06-25 Thread Julien Cigar
On Thu, Jun 25, 2020 at 12:07:40PM -0400, Mike Bayer wrote: > is "question_choice" a table name? use > json_agg(literal_column("question_choice")) Thank you, it works with literal_column() :) > > > > On Thu, Jun 25, 2020, at 5:38 AM, Julien Cigar wrot

[sqlalchemy] jsonb_agg with an InstrumentedAttribute

2020-06-25 Thread Julien Cigar
) any idea how could I achieve this ? Thanks! Julien -- Julien Cigar Belgian Biodiversity Platform (http://www.biodiversity.be) PGP fingerprint: EEF9 F697 4B68 D275 7B11 6A25 B2BB 3710 A204 23C0 No trees were killed in the creation of this message. However, many electrons were terribly

Re: [sqlalchemy] change an existing relationship

2019-09-27 Thread Julien Cigar
On Fri, Sep 27, 2019 at 09:59:49AM -0400, Mike Bayer wrote: > > > On Fri, Sep 27, 2019, at 9:34 AM, Julien Cigar wrote: > > On Fri, Sep 27, 2019 at 09:03:53AM -0400, Mike Bayer wrote: > > > > > > > > > On Fri, Sep 27, 2019, at 6:26 AM, Julien Cigar wr

Re: [sqlalchemy] change an existing relationship

2019-09-27 Thread Julien Cigar
On Fri, Sep 27, 2019 at 09:03:53AM -0400, Mike Bayer wrote: > > > On Fri, Sep 27, 2019, at 6:26 AM, Julien Cigar wrote: > > On Thu, Sep 26, 2019 at 11:39:52AM -0400, Mike Bayer wrote: > > > that's not supported, I would suggest trying to solve your problem i

Re: [sqlalchemy] change an existing relationship

2019-09-27 Thread Julien Cigar
lowing: > > > > mapper = orm.class_mapper(MyClass) > > prop = mapper.get_property('some_relationship') > > prop.lazy = 'noload' > > > > but it doesn't seems to work, as the property is still loaded > > > > Any idea if this is possible? > > >

[sqlalchemy] change an existing relationship

2019-09-26 Thread Julien Cigar
idea if this is possible? Thanks, Julien -- Julien Cigar Belgian Biodiversity Platform (http://www.biodiversity.be) PGP fingerprint: EEF9 F697 4B68 D275 7B11 6A25 B2BB 3710 A204 23C0 No trees were killed in the creation of this message. However, many electrons were terribly inconvenienced

Re: [sqlalchemy] primaryjoin and remote/foreign sides

2019-06-25 Thread Julien Cigar
ing :) this is with https://gist.github.com/silenius/5e1c9ec7b138115d9f7271860adca2df and SQLAlchemy generates https://gist.github.com/silenius/2f9df00575daab6d009e43dff92a3902 On Fri, Jun 21, 2019 at 02:32:36AM -0700, Julien Cigar wrote: > > > On Thursday, June 20, 2019 at 4:24:14 PM UTC+2, Mike

Re: [sqlalchemy] primaryjoin and remote/foreign sides

2019-06-21 Thread Julien Cigar
On Thursday, June 20, 2019 at 4:24:14 PM UTC+2, Mike Bayer wrote: > > > > On Thu, Jun 20, 2019, at 8:39 AM, Julien Cigar wrote: > > > > On Wednesday, June 19, 2019 at 9:53:42 PM UTC+2, Mike Bayer wrote: > > > > On Wed, Jun 19, 2019, at 10:50 AM, Julien Cigar

Re: [sqlalchemy] primaryjoin and remote/foreign sides

2019-06-20 Thread Julien Cigar
On Wednesday, June 19, 2019 at 9:53:42 PM UTC+2, Mike Bayer wrote: > > > > On Wed, Jun 19, 2019, at 10:50 AM, Julien Cigar wrote: > > That's the (almost) final version if you're interrested: > https://gist.github.com/silenius/568aca7545e1bc0400b53b6ec157807d > >

Re: [sqlalchemy] primaryjoin and remote/foreign sides

2019-06-19 Thread Julien Cigar
That's the (almost) final version if you're interrested: https://gist.github.com/silenius/568aca7545e1bc0400b53b6ec157807d On Wednesday, June 19, 2019 at 4:44:55 PM UTC+2, Julien Cigar wrote: > > > > On Wednesday, June 19, 2019 at 4:09:55 PM UTC+2, Mike Bayer wrote: >> >&

Re: [sqlalchemy] primaryjoin and remote/foreign sides

2019-06-19 Thread Julien Cigar
On Wednesday, June 19, 2019 at 4:09:55 PM UTC+2, Mike Bayer wrote: > > > > On Wed, Jun 19, 2019, at 4:48 AM, Julien Cigar wrote: > > Thank you very much, it almost works ! > > I have one minor issue, as translation_cls is involved in joined load > inheritance

Re: [sqlalchemy] primaryjoin and remote/foreign sides

2019-06-19 Thread Julien Cigar
adding use_labels=True to the select fixed the problem :) On Wednesday, June 19, 2019 at 10:47:57 AM UTC+2, Julien Cigar wrote: > > Thank you very much, it almost works ! > > I have one minor issue, as translation_cls is involved in joined load > inheritance the select([

Re: [sqlalchemy] primaryjoin and remote/foreign sides

2019-06-19 Thread Julien Cigar
_alias2, > primaryjoin=and_( > foreign(_alias2.content_id) == content_cls.content_id, > _alias.c.index == 1, > ), > lazy="joined", > uselist=False, >

Re: [sqlalchemy] primaryjoin and remote/foreign sides

2019-06-18 Thread Julien Cigar
the "current" translation in one query, and that it is transparent (it's a Pyramid plugin), that's why I'm also using hybrid properties On Tuesday, June 18, 2019 at 3:38:36 PM UTC+2, Mike Bayer wrote: > > > > On Tue, Jun 18, 2019, at 6:21 AM, Julien Cigar wrote: > >

[sqlalchemy] Re: primaryjoin and remote/foreign sides

2019-06-18 Thread Julien Cigar
On Tuesday, June 18, 2019 at 12:20:55 PM UTC+2, Julien Cigar wrote: > > Hello, > > I'm trying to add a 'read-only' relationship involving a subquery and I > have some problems with remote and foreign sides, SQLAlchemy returns: > > sqlalchemy.exc.Argume

[sqlalchemy] primaryjoin and remote/foreign sides

2019-06-18 Thread Julien Cigar
Hello, I'm trying to add a 'read-only' relationship involving a subquery and I have some problems with remote and foreign sides, SQLAlchemy returns: sqlalchemy.exc.ArgumentError: Relationship Folder.current_translation could not determine any unambiguous local/remote column pairs based on join

Re: [sqlalchemy] virtual relationship..?

2019-05-10 Thread Julien Cigar
xy, but less flexible and read-only. OK I'll make a separate property, I had some vague idea about using some QueryEvents to manipulate the query, but it sounds a bit complicated and hazardous Thanks :) > > On Thu, May 9, 2019 at 6:38 AM Julien Cigar wrote: > > > > Dear SQ

[sqlalchemy] virtual relationship..?

2019-05-09 Thread Julien Cigar
ase level which forbids a link between a virtual role and an account). What would be a good way to do that in SQLAlchemy? (1) https://gist.github.com/silenius/f7e4f4da9370e5db182e41d7ae93d324 Thank you, Julien -- Julien Cigar Belgian Biodiversity Platform (http://www.biodiversity.be) PGP fingerprin

Re: [sqlalchemy] mapping a class against multiple tables + relationship() .. ?

2018-05-25 Thread Julien Cigar
for a property which is already lazy='joined' loaded in the previously query, and I wonder if there is way to avoid that .. ? Thanks ! Julien > > > > On Thu, Apr 26, 2018 at 6:54 AM, Julien Cigar <julien.ci...@gmail.com> wrote: > > Hello Mike, > > > > I final

Re: [sqlalchemy] Re: __init__ method

2018-04-27 Thread Julien Cigar
oglegroups.com. > To post to this group, send email to sqlalchemy@googlegroups.com. > Visit this group at https://groups.google.com/group/sqlalchemy. > For more options, visit https://groups.google.com/d/optout. -- Julien Cigar Belgian Biodiversity Platform (http://www.biodiversity.be) PGP fingerprint: EE

Re: [sqlalchemy] QueuePool limit overflow and Pyramid sub-requests

2018-04-26 Thread Julien Cigar
tp://www.sqlalchemy.org/ > > To post example code, please provide an MCVE: Minimal, Complete, and > Verifiable Example. See http://stackoverflow.com/help/mcve for a full > description. > --- > You received this message because you are subscribed to the Google Grou

Re: [sqlalchemy] mapping a class against multiple tables + relationship() .. ?

2018-04-26 Thread Julien Cigar
zy='subquery' loaded and for which only related _translation tables are JOIN. I'm not sure if I should add/overwrite the "translations" relationship in every entity (Event, Document, ...).. In advance, a big "thank you" for the time spent analyzing this :) Julien On Fri, Apr 13,

Re: [sqlalchemy] mapping a class against multiple tables + relationship() .. ?

2018-04-13 Thread Julien Cigar
er <mike...@zzzcomputing.com> wrote: > > On Wed, Apr 11, 2018 at 6:15 AM, Julien Cigar <julien.ci...@gmail.com> > > wrote: > >> On Tue, Apr 10, 2018 at 11:53:09AM -0400, Mike Bayer wrote: > >>> On Tue, Apr 10, 2018 at 9:28 AM, Julien Cigar <julien.ci...@g

Re: [sqlalchemy] Use of in_() for relationships

2018-04-12 Thread Julien Cigar
> To unsubscribe from this group and stop receiving emails from it, send an > email to sqlalchemy+unsubscr...@googlegroups.com. > To post to this group, send email to sqlalchemy@googlegroups.com. > Visit this group at https://groups.google.com/group/sqlalchemy. > For more options, vi

Re: [sqlalchemy] mapping a class against multiple tables + relationship() .. ?

2018-04-11 Thread Julien Cigar
On Tue, Apr 10, 2018 at 11:53:09AM -0400, Mike Bayer wrote: > On Tue, Apr 10, 2018 at 9:28 AM, Julien Cigar <julien.ci...@gmail.com> wrote: > > Hello, > > > > I wondered if it is possible to use a class mapped against multiple > > tables as a relationship() in a

[sqlalchemy] mapping a class against multiple tables + relationship() .. ?

2018-04-10 Thread Julien Cigar
/silenius/561b13f4b987c36434cd81e2c08cab6e#file-foo-py -- Julien Cigar Belgian Biodiversity Platform (http://www.biodiversity.be) PGP fingerprint: EEF9 F697 4B68 D275 7B11 6A25 B2BB 3710 A204 23C0 No trees were killed in the creation of this message. However, many electrons were terribly

Re: [sqlalchemy] orm.relationship() with dynamic part ?

2018-04-09 Thread Julien Cigar
bake_queries=False on this relationship(). > > if it doesn't work, there's other ways to do this too. > > Thanks, it works well with bindparam(...) ! Just curious: what are the other ways of doing this ? > > On Thu, Apr 5, 2018 at 10:27 AM, Julien Cigar <julien.ci...@gmail.com>

[sqlalchemy] orm.relationship() with dynamic part ?

2018-04-05 Thread Julien Cigar
githubusercontent.com/silenius/7f9f0e55cf8ea700222f67f88313e00f/raw/947151d597b8d95513580316ebb79f886be37b5d/sa.sql which is exactly what I want ..! Thanks :) Julien -- Julien Cigar Belgian Biodiversity Platform (http://www.biodiversity.be) PGP fingerprint: EEF9 F697 4B68 D275 7B11 6A25 B2BB 3710

Re: [sqlalchemy] joined load inheritance with extra joins.. possible?

2018-04-03 Thread Julien Cigar
On Tue, Apr 03, 2018 at 10:05:22AM -0400, Mike Bayer wrote: > On Tue, Apr 3, 2018 at 9:59 AM, Julien Cigar <julien.ci...@gmail.com> wrote: > > On Tue, Apr 03, 2018 at 12:20:53PM +0200, Julien Cigar wrote: > >> On Thu, Mar 22, 2018 at 10:58:56AM +0100, Julien Cigar wrot

Re: [sqlalchemy] joined load inheritance with extra joins.. possible?

2018-04-03 Thread Julien Cigar
On Tue, Apr 03, 2018 at 12:20:53PM +0200, Julien Cigar wrote: > On Thu, Mar 22, 2018 at 10:58:56AM +0100, Julien Cigar wrote: > > On Tue, Mar 20, 2018 at 08:32:14PM -0400, Mike Bayer wrote: > > > I think it would be a lot easier to have the corresponding translation >

Re: [sqlalchemy] joined load inheritance with extra joins.. possible?

2018-04-03 Thread Julien Cigar
On Thu, Mar 22, 2018 at 10:58:56AM +0100, Julien Cigar wrote: > On Tue, Mar 20, 2018 at 08:32:14PM -0400, Mike Bayer wrote: > > I think it would be a lot easier to have the corresponding translation > > linked off using relationship(). can you work with that? > He

Re: [sqlalchemy] joined load inheritance with extra joins.. possible?

2018-03-23 Thread Julien Cigar
maybe some proxy-like properties too Thanks > > On Tue, Mar 20, 2018 at 9:19 AM, Julien Cigar <julien.ci...@gmail.com> wrote: > > Hello, > > > > I have an existing CMS-like application which uses joined table > > inheritance at its core. Basically I have a

[sqlalchemy] joined load inheritance with extra joins.. possible?

2018-03-20 Thread Julien Cigar
ON document_translation.document_id =3D document.content_id=20 AND document_translation.lang =3D 'some_language_code' If not, what would be the best approach? Thanks ! -- Julien Cigar Belgian Biodiversity Platform (http://www.biodiversity.be) PGP fingerprint: EEF9 F697 4B68 D275 7B11 6A25 B2BB 3710 A204 23C0 No trees were

Re: [sqlalchemy] loading of relationships

2015-09-25 Thread Julien Cigar
On Thu, Sep 24, 2015 at 11:16:37AM -0400, Mike Bayer wrote: > > > On 9/24/15 9:32 AM, Julien Cigar wrote: > > Hello, > > > > I'm using SQLAlchemy 1.0.8 with joinedload inheritance. On one of the > > Child I have a relationship property and I wondered if there is

[sqlalchemy] loading of relationships

2015-09-24 Thread Julien Cigar
here was already something in SQLAlchemy do handle this case (other than joinedload(), etc ..) ? Thanks! Julien -- Julien Cigar Belgian Biodiversity Platform (http://www.biodiversity.be) PGP fingerprint: EEF9 F697 4B68 D275 7B11 6A25 B2BB 3710 A204 23C0 No trees were killed in the creation of th

Re: [sqlalchemy] relationship problem

2015-03-12 Thread Julien Cigar
On Mon, Mar 02, 2015 at 12:15:51PM -0500, Michael Bayer wrote: Julien Cigar jci...@ulb.ac.be wrote: On Sun, Mar 01, 2015 at 01:53:30PM +0100, Julien Cigar wrote: On Fri, Feb 27, 2015 at 11:38:05PM -0500, Michael Bayer wrote: On Feb 26, 2015, at 5:56 AM, Julien Cigar jci...@ulb.ac.be

Re: [sqlalchemy] relationship problem

2015-03-02 Thread Julien Cigar
On Sun, Mar 01, 2015 at 01:53:30PM +0100, Julien Cigar wrote: On Fri, Feb 27, 2015 at 11:38:05PM -0500, Michael Bayer wrote: On Feb 26, 2015, at 5:56 AM, Julien Cigar jci...@ulb.ac.be wrote: On Wed, Feb 25, 2015 at 06:10:55PM -0500, Michael Bayer wrote: Julien Cigar

Re: [sqlalchemy] relationship problem

2015-03-01 Thread Julien Cigar
On Fri, Feb 27, 2015 at 11:38:05PM -0500, Michael Bayer wrote: On Feb 26, 2015, at 5:56 AM, Julien Cigar jci...@ulb.ac.be wrote: On Wed, Feb 25, 2015 at 06:10:55PM -0500, Michael Bayer wrote: Julien Cigar jci...@ulb.ac.be wrote: On Thu, Feb 19, 2015 at 11:31:10AM -0500

Re: [sqlalchemy] SQL Alchemy on Insert to DB

2015-03-01 Thread Julien Cigar
@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout. -- Julien Cigar Belgian Biodiversity Platform (http://www.biodiversity.be) PGP fingerprint: EEF9 F697 4B68 D275 7B11 6A25 B2BB 3710 A204 23C0 No trees were killed

Re: [sqlalchemy] SQL Alchemy on Insert to DB

2015-03-01 Thread Julien Cigar
. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout. -- Julien Cigar Belgian Biodiversity Platform (http://www.biodiversity.be) PGP fingerprint: EEF9 F697 4B68

Re: [sqlalchemy] relationship problem

2015-02-26 Thread Julien Cigar
On Wed, Feb 25, 2015 at 06:10:55PM -0500, Michael Bayer wrote: Julien Cigar jci...@ulb.ac.be wrote: On Thu, Feb 19, 2015 at 11:31:10AM -0500, Michael Bayer wrote: Julien Cigar jci...@ulb.ac.be wrote: On Thu, Feb 19, 2015 at 02:45:43PM +0100, Julien Cigar wrote: Hello, I'm

Re: [sqlalchemy] relationship problem

2015-02-24 Thread Julien Cigar
On Thu, Feb 19, 2015 at 11:31:10AM -0500, Michael Bayer wrote: Julien Cigar jci...@ulb.ac.be wrote: On Thu, Feb 19, 2015 at 02:45:43PM +0100, Julien Cigar wrote: Hello, I'm using SQLAlchemy 0.9.8 with PostgreSQL and the reflection feature of SQLAlchemy. I have the following

[sqlalchemy] relationship problem

2015-02-19 Thread Julien Cigar
) .. Any idea how to handle this with SQLAlchemy ? Thanks :) Julien -- Julien Cigar Belgian Biodiversity Platform (http://www.biodiversity.be) PGP fingerprint: EEF9 F697 4B68 D275 7B11 6A25 B2BB 3710 A204 23C0 No trees were killed in the creation of this message. However, many electrons were

Re: [sqlalchemy] relationship problem

2015-02-19 Thread Julien Cigar
On Thu, Feb 19, 2015 at 02:45:43PM +0100, Julien Cigar wrote: Hello, I'm using SQLAlchemy 0.9.8 with PostgreSQL and the reflection feature of SQLAlchemy. I have the following tables (only relevant parts are show): https://gist.github.com/silenius/390bb9937490730741f2

Re: [sqlalchemy] relationship problem

2015-02-19 Thread Julien Cigar
On Thu, Feb 19, 2015 at 11:31:10AM -0500, Michael Bayer wrote: Julien Cigar jci...@ulb.ac.be wrote: On Thu, Feb 19, 2015 at 02:45:43PM +0100, Julien Cigar wrote: Hello, I'm using SQLAlchemy 0.9.8 with PostgreSQL and the reflection feature of SQLAlchemy. I have the following

Re: [sqlalchemy] SQLAlchemy 0.9.0 Released

2013-12-31 Thread Julien Cigar
Thank you Mike! I'm pretty sure that SQLAlchemy will stay my favourite Python library in 2014 :) On Mon, Dec 30, 2013 at 07:14:40PM -0500, Michael Bayer wrote: Hey list - SQLAlchemy release 0.9.0 is now available. After about a year's worth of development, 0.9.0 is the first official

Re: [sqlalchemy] question about race conditions

2013-12-05 Thread Julien Cigar
On Thu, Dec 05, 2013 at 10:25:46AM -0800, Jonathan Vanasco wrote: i'm looking at moving some raw sql in twisted to SqlAlchemy and have a question. I have a multi-threaded twisted daemon that tends to generate a lot of race conditions on a few tables that are frequently hit. I get

Re: [sqlalchemy] contains_eager and order_by

2013-10-08 Thread Julien Cigar
On Mon, Oct 07, 2013 at 11:28:21AM -0400, Michael Bayer wrote: On Oct 7, 2013, at 6:06 AM, Julien Cigar jci...@ulb.ac.be wrote: Hello, I have the following query: entity = orm.with_polymorphic( Content, [Event, News] ) q = db.Session.query(entity) The Event class

[sqlalchemy] virtual-like entities, concrete table inheritance

2013-05-22 Thread Julien Cigar
Hello, I'm currently implementing a RBAC-like model for a webapp with the usual suspects: users, roles, permissions, etc where a Role has one or more Permissions, and an User can be in 1 or more Role. I would like to some virtual-like Role that are automatically attribued in some

Re: [sqlalchemy] EAV Optimizations

2013-05-16 Thread Julien Cigar
data (although I would probably use HSTORE under PostgreSQL). But a large EAV based project sounds terribly bad to me. On May 14, 2013, at 10:49 AM, Julien Cigar jci...@ulb.ac.be wrote: On 05/14/2013 16:09, Michael Bayer wrote: EAVs have a definite place and with judicious use

Re: [sqlalchemy] EAV Optimizations

2013-05-14 Thread Julien Cigar
On 05/14/2013 02:22, Lycovian wrote: 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

Re: [sqlalchemy] EAV Optimizations

2013-05-14 Thread Julien Cigar
On 05/14/2013 16:09, Michael Bayer wrote: EAVs have a definite place and with judicious use they are extremely useful. just curious: could you give an example where EAV is useful ? On May 14, 2013, at 4:37 AM, Julien Cigar jci...@ulb.ac.be wrote: On 05/14/2013 02:22, Lycovian wrote

Re: [sqlalchemy] Re: How to change polymorphic_identity dynamically

2013-05-06 Thread Julien Cigar
On 05/06/2013 13:46, sajuptpm wrote: Hi, I also tried like this, But not working instance_of_B.__mapper_args__[polymorphic_identity] = type_c DBSession.add(instance_of_B) transaction.commit(); and instance_of_B.__mapper__.polymorphic_identity = type_c DBSession.add(instance_of_B)

[sqlalchemy] TypeDecorator to SQL expression ..?

2013-04-22 Thread Julien Cigar
Hello, With the following custom type: class JSONEncodedDict(types.TypeDecorator): Represents an immutable structure as a JSON-encoded string. impl = types.TEXT def process_bind_param(self, value, dialect): return json.dumps(value) if value is not None else None def

Re: [sqlalchemy] Automatic created and modified timestamp columns (best practice?!)

2013-04-03 Thread Julien Cigar
On 03/27/2013 14:26, Moritz Schlarb wrote: Hi there everyone, I am kind of looking for a best practice on how to implement automatically setting and updating columns for created and modified timestamps in SQLAlchemy, preferrably database-agnostic. First of all, is DateTime the appropriate

Re: [sqlalchemy] advices

2013-03-19 Thread Julien Cigar
On 03/18/2013 18:47, Michael Bayer wrote: On Mar 15, 2013, at 3:19 PM, Julien Cigar jci...@ulb.ac.be wrote: On 03/14/2013 19:56, Michael Bayer wrote: On Mar 12, 2013, at 5:13 AM, Julien Cigar jci...@ulb.ac.be wrote: Hello, I have written a CMS which is, among other, based on the joined

Re: [sqlalchemy] advices

2013-03-15 Thread Julien Cigar
On 03/14/2013 19:56, Michael Bayer wrote: On Mar 12, 2013, at 5:13 AM, Julien Cigar jci...@ulb.ac.be wrote: Hello, I have written a CMS which is, among other, based on the joined load inheritance feature of SQLAlchemy. It is quite simple: the user is able to add objects in containers

[sqlalchemy] advices

2013-03-12 Thread Julien Cigar
Hello, I have written a CMS which is, among other, based on the joined load inheritance feature of SQLAlchemy. It is quite simple: the user is able to add objects in containers and can select the default polymorphic loading for a container. In gross it can dynamically select which tables

Re: [sqlalchemy] window functions marked deferred

2013-03-10 Thread Julien Cigar
On 03/08/2013 18:09, Michael Bayer wrote: On Mar 8, 2013, at 5:31 AM, Julien Cigar jci...@ulb.ac.be wrote: Hello, Shouldn't SQLAlchemy emit (at least) a warning when a window function is mapped with an orm.column_property(), marked deferred=True, and accessed without query.options

[sqlalchemy] trying 0.8.0b2

2013-02-15 Thread Julien Cigar
Hello, I'm trying to upgrade a rather big webapp from 0.7.10 to 0.8.0b2 and I'm facing a strange RuntimeError: maximum recursion depth exceeded error: http://pastebin.ca/2314149 Any idea what could be wrong? (I'll start digging but I would like to avoid a loss of time if it's just a simple

Re: [sqlalchemy] trying 0.8.0b2

2013-02-15 Thread Julien Cigar
I forgot to add my mappers definition: http://pastie.org/6176391 On 02/15/2013 15:04, Julien Cigar wrote: Hello, I'm trying to upgrade a rather big webapp from 0.7.10 to 0.8.0b2 and I'm facing a strange RuntimeError: maximum recursion depth exceeded error: http://pastebin.ca/2314149 Any idea

Re: [sqlalchemy] trying 0.8.0b2

2013-02-15 Thread Julien Cigar
if you can try to reproduce with a test case that would be helpful. On Feb 15, 2013, at 9:04 AM, Julien Cigar jci...@ulb.ac.be wrote: Hello, I'm trying to upgrade a rather big webapp from 0.7.10 to 0.8.0b2 and I'm facing a strange RuntimeError: maximum recursion depth exceeded error: http

Re: [sqlalchemy] trying 0.8.0b2

2013-02-15 Thread Julien Cigar
Same with tip, except that I get a RuntimeError: maximum recursion depth exceeded in cmp instead: 'http://pastebin.ca/2314168 I'll dig a little more tonight ... On 02/15/2013 15:49, Julien Cigar wrote: I'll give a try with tip .. :) btw the old svn url is still used while fetching sqlalchemy

[sqlalchemy] contains_eager + aliased

2012-12-06 Thread Julien Cigar
Hello, Any idea why the following doesn't work ? : Topic2= orm.aliased(Topic) q= Occurrence.query.\ join(Occurrence.datasheet).\ options(orm.contains_eager(Occurrence.datasheet)).\ join(Topic2).\ options(orm.contains_eager(DataSheet.topic,alias=Topic2)).\

Re: [sqlalchemy] contains_eager + aliased

2012-12-06 Thread Julien Cigar
), orm.contains_eager(Species.datasheet, alias=Foo), orm.contains_eager(Site.datasheet, alias=Foo), orm.contains_eager(Occurrence.species, Occurrence.site) ) but it doesn't seems to work ... Any idea ? :) Thank you, Julien On 12/06/2012 13:47, Julien Cigar wrote: Hello, Any idea why the following doesn't

Re: [sqlalchemy] contains_eager + aliased

2012-12-06 Thread Julien Cigar
On 12/06/2012 15:45, Michael Bayer wrote: On Dec 6, 2012, at 7:47 AM, Julien Cigar wrote: Hello, Any idea why the following doesn't work ? : Topic2= orm.aliased(Topic) q= Occurrence.query.\ join(Occurrence.datasheet).\ options(orm.contains_eager(Occurrence.datasheet)).\ join

Re: [sqlalchemy] contains_eager + aliased

2012-12-06 Thread Julien Cigar
On 12/06/2012 16:02, Julien Cigar wrote: On 12/06/2012 15:45, Michael Bayer wrote: On Dec 6, 2012, at 7:47 AM, Julien Cigar wrote: Hello, Any idea why the following doesn't work ? : Topic2= orm.aliased(Topic) q= Occurrence.query.\ join(Occurrence.datasheet).\ options

Re: [sqlalchemy] CircularDependencyError

2012-07-05 Thread Julien Cigar
On 07/04/2012 17:29, Julien Cigar wrote: On 07/04/2012 16:38, Michael Bayer wrote: On Jul 4, 2012, at 9:16 AM, Julien Cigar wrote: Hello, I have a rather strange CircularDependencyError with the following use-case: - I have a content table and a data table. - content is mapped

[sqlalchemy] CircularDependencyError

2012-07-04 Thread Julien Cigar
Hello, I have a rather strange CircularDependencyError with the following use-case: - I have a content table and a data table. - content is mapped with Content and data is mapped with File. - File is a Content (joined table inheritance), so File has a foreign key to Content (through the

Re: [sqlalchemy] CircularDependencyError

2012-07-04 Thread Julien Cigar
On 07/04/2012 16:38, Michael Bayer wrote: On Jul 4, 2012, at 9:16 AM, Julien Cigar wrote: Hello, I have a rather strange CircularDependencyError with the following use-case: - I have a content table and a data table. - content is mapped with Content and data is mapped with File. - File

Re: [sqlalchemy] join + joined inheritance

2012-04-23 Thread Julien Cigar
On 04/20/2012 21:38, Michael Bayer wrote: On Apr 20, 2012, at 9:32 AM, Julien Cigar wrote: Hello, I'm using joined load inheritance in one of my project, and I have the following query: q = Content.query.outerjoin((File, File.content_id == Content.id), File.mime, Mime.major) SQLAlchemy

[sqlalchemy] join + joined inheritance

2012-04-20 Thread Julien Cigar
Hello, I'm using joined load inheritance in one of my project, and I have the following query: q = Content.query.outerjoin((File, File.content_id == Content.id), File.mime, Mime.major) SQLAlchemy generates a subquery for the outer join. Any idea how to ask SQLAlchemy to generate a shorter

Re: [sqlalchemy] Re: xml approach

2012-03-26 Thread Julien Cigar
On 03/23/2012 10:37, lars van gemerden wrote: Hi Julian, Thanks, I am looking into it and it looks interesting. Have you done much testing yet? How do you (plan to; haven't looked at too much detail yet) check for circular references (like backrefs)? circular references aren't handled yet

[sqlalchemy] with_lockmode('share') ?

2012-03-21 Thread Julien Cigar
Hello, I'm using SQLAlchemy 0.7.6 and PostgreSQL 9.0.7 which support a FOR UPDATE and a FOR SHARE clause to lock selected rows. I noticed that the .with_lockmode() method of the Query object

Re: [sqlalchemy] with_lockmode('share') ?

2012-03-21 Thread Julien Cigar
has only FOR UPDATE and FOR UPDATE NOWAIT at the moment, easy enough to add more options though it would be helpful if someone could volunteer a patch on it (with tests as always!): http://www.sqlalchemy.org/trac/ticket/2445 On Mar 21, 2012, at 6:00 AM, Julien Cigar wrote: Hello, I'm using

[sqlalchemy] Query.count() with joined load relations and innerjoin=True

2012-02-17 Thread Julien Cigar
Hello, Is there a reason why a .count() on a Query object doesn't (LEFT) JOIN all the relations marked with lazy='joined' in the Mapper? I guess it's to avoid unnecessary JOINs, but sometimes it can lead to strange results if the relation is marked with innerjoin=True, for example: q =

Re: [sqlalchemy] Query.count() with joined load relations and innerjoin=True

2012-02-17 Thread Julien Cigar
code is here http://www.pastie.org/3401784 and the corresponding SQL is here http://pastie.org/3401782 (the first one is the COUNT and the second one the full query) Thank you! Julien On Feb 17, 2012, at 5:41 AM, Julien Cigar wrote: Hello, Is there a reason why a .count() on a Query object

Re: [sqlalchemy] Query.count() with joined load relations and innerjoin=True

2012-02-17 Thread Julien Cigar
for support, Julien On Feb 17, 2012, at 9:55 AM, Julien Cigar wrote: On 02/17/2012 15:38, Michael Bayer wrote: what version of SQLA is this ? count() was changed in 0.7 to run the query as is each time, wrapping it in a subquery. Otherwise, can I see more of a complete example I can run here

[sqlalchemy] 0.7.4 and multiple schemas

2012-01-24 Thread Julien Cigar
Hello, I upgraded to 0.7.4 together with PostgreSQL 9.0.5. I have a database with several schemas, and it looks like the handle of schemas changed in 0.7.4 I altered the default database search_path with: {{{ xxx=# alter DATABASE xxx SET search_path TO public,gis,cr2010; }}} and I used to

Re: [sqlalchemy] money type for Postgresql

2011-12-28 Thread Julien Cigar
Using FLOAT for monetary amounts is an extremely bad idea because of the inexactness of storage and arithmetic .. Using MONEY is discouraged because it is too locale-sensitive NUMERIC should be used instead On 12/28/2011 11:48, Martijn Moeling wrote: I use Float for money at the moment. I am

Re: [sqlalchemy] money type for Postgresql

2011-12-27 Thread Julien Cigar
don't use the MONEY type in PostgreSQL, use NUMERIC instead. On 12/27/2011 20:39, dgardner wrote: Quick hack, figured I would share since there seemed to be other people asking about it. I couldn't get it to work with autoload=True for table reflection. --- from sqlalchemy import types from

[sqlalchemy] how would you do that with SQLAlchemy ..?

2011-02-09 Thread Julien Cigar
Hello, I'm implementing an authentication system in my webapp, with the usual users / roles. I have a table human, a table role and a table human_role. I have one special user anonymous which has no password, no email, etc and two special roles : anonymous user and authenticated user. If

[sqlalchemy] joinedload(), contains_eager(), ...

2010-11-30 Thread Julien Cigar
Hello, I'm busy to update an application to the last SQLAlchemy version. I have to following mapped object, with a relation: orm.mapper(Image, table.images, properties = { 'owner' : orm.relationship( Participant, uselist = False ) }) In previous version of SQLAlchemy I

Re: [sqlalchemy] Dynamic query

2010-10-14 Thread Julien Cigar
not better after all to have a bunch of @staticmethod in the model ... What do you think ? On 10/13/2010 11:21, Julien Cigar wrote: On 10/12/2010 18:05, Julien Cigar wrote: On 10/12/2010 17:09, Michael Bayer wrote: On Oct 12, 2010, at 7:39 AM, Julien Cigar wrote: Hello, any idea why

Re: [sqlalchemy] Dynamic query

2010-10-13 Thread Julien Cigar
On 10/12/2010 18:05, Julien Cigar wrote: On 10/12/2010 17:09, Michael Bayer wrote: On Oct 12, 2010, at 7:39 AM, Julien Cigar wrote: Hello, any idea why with # Query class BaseQuery(orm.Query): @dynamic def method_a(self): ... def method_b(self): ... class FooQuery(BaseQuery): ... class

[sqlalchemy] Dynamic query

2010-10-12 Thread Julien Cigar
Hello, any idea why with # Query class BaseQuery(orm.Query): @dynamic def method_a(self): ... def method_b(self): ... class FooQuery(BaseQuery): ... class BarQuery(FooQuery): @dynamic def method_c(self):

Re: [sqlalchemy] Dynamic query

2010-10-12 Thread Julien Cigar
On 10/12/2010 17:09, Michael Bayer wrote: On Oct 12, 2010, at 7:39 AM, Julien Cigar wrote: Hello, any idea why with # Query class BaseQuery(orm.Query): @dynamic def method_a(self): ... def method_b(self): ... class FooQuery(BaseQuery

  1   2   >