Re: [sqlalchemy] Query before_compile issue

2019-10-28 Thread eric . lemoine
> > today, we have this issue, which I can confirm has existed since version > 1.2 over two years ago, reported for the first time ever here, and then a > day later in https://github.com/sqlalchemy/sqlalchemy/issues/4947 . > Even more funny is that this Issue uses a tenant in the provided

Re: [sqlalchemy] Query before_compile issue

2019-10-23 Thread eric . lemoine
On Wed, Oct 23, 2019 at 3:16 PM Mike Bayer wrote: > > > On Tue, Oct 22, 2019, at 12:30 PM, eric.lemo...@gmail.com wrote: > > > > > it sounds like you should use a bound parameter with a lambda inside of > it, there's not an explicit "on lazyload" hook at the moment. > > > Yep, that seems to be

Re: [sqlalchemy] Query before_compile issue

2019-10-22 Thread eric . lemoine
it sounds like you should use a bound parameter with a lambda inside of it, > there's not an explicit "on lazyload" hook at the moment. > Yep, that seems to be doing the job! -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code,

Re: [sqlalchemy] Query before_compile issue

2019-10-22 Thread eric . lemoine
On Tue, Oct 22, 2019 at 5:59 PM Mike Bayer wrote: > > > On Tue, Oct 22, 2019, at 11:58 AM, Eric Lemoine wrote: > > > > The first time before_compile is called twice, one call for the SELECT FROM > "user" query, and another call for the SELECT FROM "

Re: [sqlalchemy] Query before_compile issue

2019-10-22 Thread Eric Lemoine
> The first time before_compile is called twice, one call for the SELECT FROM > "user" query, and another call for the SELECT FROM "address" query. But the > second time before_compile is called only once. It's called for the SELECT > FROM "user" query, but not for the SELECT FROM "addresses"

[sqlalchemy] Query before_compile issue

2019-10-22 Thread Eric Lemoine
Hi I want to use the FilteredQuery pattern [1], but I am facing a problem related to SQLAlchemy not calling "before_compile" as often as I'd expect it. Here's a simple example: @event.listens_for(Query, "before_compile", retval=True) def before_compile(query): print("X before_compiled

Re: [sqlalchemy] can't adapt type 'centroid'

2012-11-28 Thread Eric Lemoine
://groups.google.com/d/msg/geoalchemy/uqr6DVzotaA/aHXcGfUDca8J. -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 94 Mail : eric.lemo...@camptocamp.com http://www.camptocamp.com -- You received this message because you are subscribed

[sqlalchemy] comparator_factory __lshift__ __rshift__

2012-09-04 Thread Eric Lemoine
doing something wrong, or is SQLAlchemy just not dealing with and for the moment? FYI, __add__ works just fine. Thank you. -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 96 Mail : eric.lemo...@camptocamp.com http

Re: [sqlalchemy] comparator_factory __lshift__ __rshift__

2012-09-04 Thread Eric Lemoine
On Tue, Sep 4, 2012 at 4:36 PM, Michael Bayer mike...@zzzcomputing.com wrote: Those methods aren't part of the contract at the moment but I can add them in. I can live without them, it'd just be nice to be able to use the actual PostGIS operators in SQLAlchemy apps. Thank you! -- Eric

Re: [sqlalchemy] comparator_factory __lshift__ __rshift__

2012-09-04 Thread Eric Lemoine
keyword argument 'escape' I should be able to override contains, no? -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 96 Mail : eric.lemo...@camptocamp.com http://www.camptocamp.com -- You received this message because

Re: [sqlalchemy] comparator_factory __lshift__ __rshift__

2012-09-04 Thread Eric Lemoine
for the explanation. -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 96 Mail : eric.lemo...@camptocamp.com http://www.camptocamp.com -- You received this message because you are subscribed to the Google Groups sqlalchemy

Re: [sqlalchemy] comparator_factory __lshift__ __rshift__

2012-09-04 Thread Eric Lemoine
On Tue, Sep 4, 2012 at 5:20 PM, Eric Lemoine eric.lemo...@camptocamp.com wrote: On Tue, Sep 4, 2012 at 5:18 PM, Michael Bayer mike...@zzzcomputing.com wrote: can't do __contains__ due to Python behavior: class Foo(object): def __add__(self, other): return (self, add, other

Re: [sqlalchemy] comparator_factory __lshift__ __rshift__

2012-09-04 Thread Eric Lemoine
On Tue, Sep 4, 2012 at 5:30 PM, Michael Bayer mike...@zzzcomputing.com wrote: On Sep 4, 2012, at 11:24 AM, Eric Lemoine wrote: On Tue, Sep 4, 2012 at 5:20 PM, Eric Lemoine eric.lemo...@camptocamp.com wrote: On Tue, Sep 4, 2012 at 5:18 PM, Michael Bayer mike...@zzzcomputing.com wrote

Re: [sqlalchemy] comparator_factory __lshift__ __rshift__

2012-09-04 Thread Eric Lemoine
On Tue, Sep 4, 2012 at 5:38 PM, Michael Bayer mike...@zzzcomputing.com wrote: On Sep 4, 2012, at 11:32 AM, Eric Lemoine wrote: On Tue, Sep 4, 2012 at 5:30 PM, Michael Bayer mike...@zzzcomputing.com wrote: On Sep 4, 2012, at 11:24 AM, Eric Lemoine wrote: On Tue, Sep 4, 2012 at 5:20 PM

[sqlalchemy] Re: column_expression issue/question

2012-09-03 Thread Eric Lemoine
call receives what's returned from the inner ST_AsBinary call). It would work if ST_AsBinary was idempotent, but it's not in PostGIS 2 (http://trac.osgeo.org/postgis/ticket/1869). I'm stuck on this one. -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac

[sqlalchemy] Re: column_expression issue/question

2012-09-02 Thread Eric Lemoine
that the fix might hit some other cases that aren't handled yet, if you get any errors about .name or .key with more complex expressions let me know. Will do. -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 96 Mail : eric.lemo

[sqlalchemy] column_expression issue/question

2012-09-01 Thread Eric Lemoine
name being geom I'd expect the following to work: s = select([lakes]) for row in conn.execute(s): geom = row['geom'] but it won't work because row does not have a geom item. Is there a solution to this issue? Thanks, -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le

Re: [sqlalchemy] Re: associationproxy for one-to-many

2012-04-23 Thread Eric Lemoine
) \ .get_property(self.target) child_cls = relationship_property.argument o = Session.query(child_cls).filter( getattr(child_cls, self.value_attr) == val).first() setattr(obj, self.target, o) Thanks again Mike for your support. -- Eric Lemoine

[sqlalchemy] Re: associationproxy for one-to-many

2012-04-20 Thread Eric Lemoine
On Mon, Apr 16, 2012 at 10:49 PM, Eric Lemoine eric.lemo...@camptocamp.com wrote: Hi I'd like to use an associationproxy for a simple many-to-one relationship: class Child(Base):     __tablename__ = 'child'     id = Column(Integer, primary_key=True)     name = Column(Unicode) class

Re: [sqlalchemy] Re: associationproxy for one-to-many

2012-04-20 Thread Eric Lemoine
On Fri, Apr 20, 2012 at 9:28 PM, Michael Bayer mike...@zzzcomputing.com wrote: On Apr 20, 2012, at 8:45 AM, Eric Lemoine wrote: On Mon, Apr 16, 2012 at 10:49 PM, Eric Lemoine eric.lemo...@camptocamp.com wrote: Hi I'd like to use an associationproxy for a simple many-to-one relationship

[sqlalchemy] associationproxy for one-to-many

2012-04-16 Thread Eric Lemoine
is not the way to go for that case. Thanks for any suggestion. -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 96 Mail : eric.lemo...@camptocamp.com http://www.camptocamp.com -- You received this message because you are subscribed

[sqlalchemy] Re: simple locking issue

2012-03-11 Thread Eric Lemoine
On Thursday, March 8, 2012, Michael Bayer mike...@zzzcomputing.com wrote: On Mar 8, 2012, at 7:28 AM, Eric Lemoine wrote: On Thu, Mar 8, 2012 at 3:59 PM, Eric Lemoine eric.lemo...@camptocamp.com wrote: Hi My code basically does: --- engine = create_engine() table = Table('table

[sqlalchemy] simple locking issue

2012-03-08 Thread Eric Lemoine
. It's like table.create created a transaction, and locked the table. Session.execute is blocked on this lock. I use Postgres. Any idea what I'm doing wrong? Thank you. -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 96 Mail

Re: [sqlalchemy] engine in column_reflect events

2012-02-29 Thread Eric Lemoine
On Tue, Feb 28, 2012 at 5:20 PM, Eric Lemoine eric.lemo...@camptocamp.com wrote: On Tue, Feb 28, 2012 at 4:46 PM, Michael Bayer mike...@zzzcomputing.com wrote: wowwell yeah, though putting it in the column_info is not how i'd want to do that.  I'd like to change the API for 0.8

Re: [sqlalchemy] engine in column_reflect events

2012-02-29 Thread Eric Lemoine
columns and generate the appropriate column_property() based on column type. i'll look into that. Thanks a lot! -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 96 Mail : eric.lemo...@camptocamp.com http://www.camptocamp.com

Re: [sqlalchemy] engine in column_reflect events

2012-02-29 Thread Eric Lemoine
that gets sent to mapper(). I guess you're referring to: http://docs.sqlalchemy.org/en/latest/orm/examples.html#examples-declarative-reflection. Iterate through the reflected table columns and generate the appropriate column_property() based on column type. -- Eric Lemoine Camptocamp France

[sqlalchemy] engine in column_reflect events

2012-02-28 Thread Eric Lemoine
. -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 96 Mail : eric.lemo...@camptocamp.com http://www.camptocamp.com -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post

Re: [sqlalchemy] engine in column_reflect events

2012-02-28 Thread Eric Lemoine
a workaround, but which forces me to have my reflection code at the application level as opposed to in GeoAlchemy. -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 96 Mail : eric.lemo...@camptocamp.com http

Re: [sqlalchemy] Re: porting GeoAlchemy to 0.7

2011-06-19 Thread Eric Lemoine
On Thu, Jun 9, 2011 at 7:21 PM, Michael Bayer mike...@zzzcomputing.com wrote: On Jun 9, 2011, at 12:37 PM, Eric Lemoine wrote: On Thu, Jun 9, 2011 at 6:28 PM, Michael Bayer mike...@zzzcomputing.com wrote: That's the default adaption provided by TypeEngine.adapt().    Provide your own

Re: [sqlalchemy] Re: porting GeoAlchemy to 0.7

2011-06-15 Thread Eric Lemoine
On Tue, Jun 14, 2011 at 3:46 PM, Michael Bayer mike...@zzzcomputing.com wrote: On Jun 14, 2011, at 3:17 AM, Eric Lemoine wrote: Here's our TypeEngine: So dialect-specific parameters are stored in self.kwargs. I can try to add a test to SQLAlchemy if you indicate me where this test should

Re: [sqlalchemy] Re: porting GeoAlchemy to 0.7

2011-06-14 Thread Eric Lemoine
On Thu, Jun 9, 2011 at 7:21 PM, Michael Bayer mike...@zzzcomputing.com wrote: On Jun 9, 2011, at 12:37 PM, Eric Lemoine wrote: On Thu, Jun 9, 2011 at 6:28 PM, Michael Bayer mike...@zzzcomputing.com wrote: That's the default adaption provided by TypeEngine.adapt().    Provide your own

[sqlalchemy] Re: porting GeoAlchemy to 0.7

2011-06-09 Thread Eric Lemoine
On Mon, Jun 6, 2011 at 9:47 PM, Eric Lemoine eric.lemo...@camptocamp.com wrote: Hi i'm currently in the process of porting GeoAlchemy to SQLAlchemy 0.7. The first issue I'm having is related to before_create and after_create DDL listeners we have in GeoAlchemy. We use before_create

Re: [sqlalchemy] Re: porting GeoAlchemy to 0.7

2011-06-09 Thread Eric Lemoine
On Thu, Jun 9, 2011 at 6:28 PM, Michael Bayer mike...@zzzcomputing.com wrote: On Jun 9, 2011, at 3:57 AM, Eric Lemoine wrote: Hi Here's another issue with porting GeoAlchemy to SQLAlchemy 0.7. So GeoA defines a TypeEngine, which looks like this: class Geometry(TypeEngine):    def

[sqlalchemy] Re: porting GeoAlchemy to 0.7

2011-06-07 Thread Eric Lemoine
', target, connection) def after_drop(self, target, connection, **kw): self('after-drop', target, connection) Thanks, -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 96 Mail : eric.lemo...@camptocamp.com http

[sqlalchemy] porting GeoAlchemy to 0.7

2011-06-06 Thread Eric Lemoine
, but I'm wondering if that's the proper way. Thanks for any guidance on that, PS: I was hoping to get inspiration from examples/postgis.py, but this example looks outdated. Maybe it should be removed from the 0.7 code base. -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le

Re: [sqlalchemy] Pypi release policy

2011-02-15 Thread Eric Lemoine
. But aren't apps supposed to use =0.6.99 to avoid backward compats issues? Apps that don't will also break when 0.7 final is on pypi. -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 96 Mail : eric.lemo...@camptocamp.com http

Re: [sqlalchemy] Pypi release policy

2011-02-15 Thread Eric Lemoine
On Tuesday, February 15, 2011, Tarek Ziadé ziade.ta...@gmail.com wrote: On Tue, Feb 15, 2011 at 3:27 PM, Eric Lemoine eric.lemo...@camptocamp.com wrote .. But aren't apps supposed to use =0.6.99 to avoid backward compats issues? Apps that don't will also break when 0.7 final is on pypi

[sqlalchemy] INSERT RETURNING question

2011-01-18 Thread Eric Lemoine
Hi Probably a very simple question. I use the ORM for inserts, with postgres 8.3. How can I get the ids resulting from my inserts' RETURNING clauses? I haven't been able to find the information in the doc. Thanks a lot, -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le

[sqlalchemy] Re: INSERT RETURNING question

2011-01-18 Thread Eric Lemoine
On Tuesday, January 18, 2011, Eric Lemoine eric.lemo...@camptocamp.com wrote: Hi Probably a very simple question. I use the ORM for inserts, with postgres 8.3. How can I get the ids resulting from my inserts' RETURNING clauses? I haven't been able to find the information in the doc. Doing

Re: [sqlalchemy] Re: INSERT RETURNING question

2011-01-18 Thread Eric Lemoine
On Tue, Jan 18, 2011 at 11:33 PM, Michael Bayer mike...@zzzcomputing.com wrote: On Jan 18, 2011, at 4:47 PM, Eric Lemoine wrote: On Tuesday, January 18, 2011, Eric Lemoine eric.lemo...@camptocamp.com wrote: Hi Probably a very simple question. I use the ORM for inserts, with postgres 8.3

Re: [sqlalchemy] passive Query

2011-01-17 Thread Eric Lemoine
. -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 96 Mail : eric.lemo...@camptocamp.com http://www.camptocamp.com -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post

[sqlalchemy] passive Query

2011-01-16 Thread Eric Lemoine
Hello For testing purposed I'd like to do query.all(). query.get() and query.count() with no actual communication with the DBMS. Is this possible? Thanks a lot, -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 96 Mail

Re: [sqlalchemy] Insert record error

2011-01-14 Thread Eric Lemoine
26.000,-120.000 43.833)) Your multipolygon WKT is ill-formed. Try with three opening and closing brackets. If that still doesn't work I suggest that we continue the discussion on the GeoAlchemy list. Cheers, -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac

[sqlalchemy] Re: Mapper.get_property question

2011-01-13 Thread Eric Lemoine
in the mapping. To go from name_key, you could say class_mapper(MyClass)._columntoproperty[t.c.name_key]. It's now clear. Thanks a lot. -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 96 Mail : eric.lemo...@camptocamp.com http

Re: [sqlalchemy] Insert record error

2011-01-13 Thread Eric Lemoine
? -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 96 Mail : eric.lemo...@camptocamp.com http://www.camptocamp.com -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post

[sqlalchemy] Mapper.get_property question

2011-01-12 Thread Eric Lemoine
') try: class_mapper(User).get_property('name_key') except InvalidRequestError: print error 1 try: class_mapper(User).get_property('name') except InvalidRequestError: print error 2 -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel

Re: [sqlalchemy] Re: engine bound to Session

2010-05-31 Thread Eric Lemoine
On Sun, May 30, 2010 at 6:20 PM, Lance Edgar lance.ed...@gmail.com wrote: On 5/30/2010 9:43 AM, Eric Lemoine wrote: On Sun, May 30, 2010 at 4:39 PM, Eric Lemoine eric.lemo...@camptocamp.com  wrote: Hello I use Pylons. Pylons does: Session = scoped_session(sessionmaker

[sqlalchemy] engine bound to Session

2010-05-30 Thread Eric Lemoine
arguments (1 given). Thanks a lot, -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 96 Mail : eric.lemo...@camptocamp.com http://www.camptocamp.com -- You received this message because you are subscribed to the Google Groups

[sqlalchemy] Re: engine bound to Session

2010-05-30 Thread Eric Lemoine
On Sun, May 30, 2010 at 4:39 PM, Eric Lemoine eric.lemo...@camptocamp.com wrote: Hello I use Pylons. Pylons does: Session = scoped_session(sessionmaker()) and then: Session.configure(bind=engine) My question: with a reference to Session how can I get the engine that's bound to it? I

[sqlalchemy] postgresql text search

2010-05-28 Thread Eric Lemoine
Hi Are there examples of using PostgreSQL's full-text search with SQLAlchemy? I'm interested in any kind of information about that. Thanks, -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 96 Mail : eric.lemo

Re: [sqlalchemy] postgresql text search

2010-05-28 Thread Eric Lemoine
On Fri, May 28, 2010 at 3:12 PM, Michael Bayer mike...@zzzcomputing.com wrote: we support the to_tsquery() syntax through the match() operator: http://www.sqlalchemy.org/trac/browser/test/dialect/test_postgresql.py#L1748 Thank you very much. -- Eric Lemoine Camptocamp France SAS Savoie

[sqlalchemy] postgres character(num) issue

2010-04-15 Thread Eric Lemoine
? Thanks a lot, -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 96 Mail : eric.lemo...@camptocamp.com http://www.camptocamp.com -- You received this message because you are subscribed to the Google Groups sqlalchemy group

Re: [sqlalchemy] postgres character(num) issue

2010-04-15 Thread Eric Lemoine
. The operator considers the blank characters as semantically insignificant and remove them. -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 96 Mail : eric.lemo...@camptocamp.com http://www.camptocamp.com -- You received

[sqlalchemy] Re: missing table in FROM CLAUSE

2010-01-07 Thread Eric Lemoine
On Thu, Jan 7, 2010 at 11:29 AM, Eric Lemoine eric.lemo...@camptocamp.com wrote: Hi I'm having a problem with a query where the FROM clause doesn't include a table that is actually required for the query. Here's my code: -- subq = subquery(None,                        columns

[sqlalchemy] issue with column_property

2009-09-29 Thread Eric Lemoine
result_process method doesn't seem to be called. Is this expected? Do I have solutions to that problem? Thanks a lot, -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 96 Mail : eric.lemo...@camptocamp.com http://www.camptocamp.com

[sqlalchemy] Re: issue with column_property

2009-09-29 Thread Eric Lemoine
On Tue, Sep 29, 2009 at 9:04 PM, Michael Bayer mike...@zzzcomputing.com wrote: Eric Lemoine wrote: Hi Here's my case: I have - my own TypeEngine class, MyTypeEngine - a Table with a Column using MyTypeEngine:   table = Table(tablename, metadata,       Column(columname, MyTypeEngine

[sqlalchemy] dynamic query selection

2009-09-13 Thread Eric Lemoine
col1, col2, col3, FROM ... And, as I said, I'd like this to be dynamic, so I don't want this to be hardwired in my mapping definition. Is this possible? Thanks a lot, -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 96 Mail

[sqlalchemy] Re: dynamic query selection

2009-09-13 Thread Eric Lemoine
On Sunday, September 13, 2009, Michael Bayer mike...@zzzcomputing.com wrote: On Sep 13, 2009, at 5:32 AM, Eric Lemoine wrote: Hello list I have a simple mapping between a class and a table. What I'd like to be able to do is dynamically change the query selection (based on some HTTP

[sqlalchemy] Re: connectionless queries with Spatial data (PostGIS)

2009-04-19 Thread Eric Lemoine
/sqlalchemygeom.py [4] http://trac.gispython.org/lab/wiki/Shapely [5] https://trac.mapfish.org/trac/mapfish/browser/trunk/MapFish/server/python/mapfish/lib/protocol.py -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 96 Mail

[sqlalchemy] Re: connectionless queries with Spatial data (PostGIS)

2009-04-19 Thread Eric Lemoine
() session.query(Road).filter(Road.road_geom == 'LINESTRING(189412 252431,189631 259122)').one() the GeomFromText function is called implicitly with the above examples. -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 96 Mail

[sqlalchemy] Re: Selecting from a self-referential mapper: recursive joins?

2008-11-25 Thread Eric Lemoine
Eric, a friendly comment: you do sound as crazy as Svil :-) Eric 2008/11/25, Eric Ongerth [EMAIL PROTECTED]: Yes, I am very glad to be free of multiversion and bitemporal concerns, although I will eventually be setting this up for partial multimaster asynchronous replication (but with a lot

[sqlalchemy] Re: polymorphic_union and key

2008-10-21 Thread Eric Lemoine
On Mon, Oct 20, 2008 at 7:46 PM, Michael Bayer [EMAIL PROTECTED] wrote: its not a known issue but sounds like a bug. a very concise test case which we can use as a unit test would help here. I hope this is good enough: from sqlalchemy import * from sqlalchemy.orm import * engine =

[sqlalchemy] Re: polymorphic_union and key

2008-10-21 Thread Eric Lemoine
. On Tuesday 21 October 2008 10:48:02 Eric Lemoine wrote: On Mon, Oct 20, 2008 at 7:46 PM, Michael Bayer [EMAIL PROTECTED] wrote: its not a known issue but sounds like a bug. a very concise test case which we can use as a unit test would help here. I hope this is good enough: from

[sqlalchemy] Re: polymorphic_union and key

2008-10-21 Thread Eric Lemoine
Great. Thanks! 2008/10/22, Michael Bayer [EMAIL PROTECTED]: I forgot to mention i fixed this for 0.4 + 0.5 in r5180/5181...thanks for the test ! On Oct 21, 2008, at 3:48 AM, Eric Lemoine wrote: On Mon, Oct 20, 2008 at 7:46 PM, Michael Bayer [EMAIL PROTECTED] wrote: its not a known

[sqlalchemy] polymorphic_union and key

2008-10-20 Thread Eric Lemoine
Hi I use concrete inheritance with two tables. I therefore use polymorphic_union. Each table has a Column object defined with a key: Column(office_name, types.Unicode, key=name). And the key doesn't work for the second table, the field name exists in the mapped objects resulting from a query but

[sqlalchemy] Re: polymorphic_union and key

2008-10-20 Thread Eric Lemoine
Will try 2008/10/20, Michael Bayer [EMAIL PROTECTED]: its not a known issue but sounds like a bug. a very concise test case which we can use as a unit test would help here. On Oct 20, 2008, at 1:33 PM, Eric Lemoine wrote: Hi I use concrete inheritance with two tables. I therefore

[sqlalchemy] Re: SQLAlchemy 0.5.0 Release Candidate 1 Released

2008-09-13 Thread Eric Lemoine
Hi. I just wanted to mention that we've been using 0.5 since the first beta in our Pylons-based web-mapping framework (www.mapfish.org) and it has given up entire satisfaction. We caricatuy use: regular CRUD operations, type definition (for PostGIS' geometry column), and concrete table

[sqlalchemy] Re: seeking advice for multi-table query

2008-09-01 Thread Eric Lemoine
) and use with_polymorphic on each request. Is my understanding correct? Eric 2008/8/31, Michael Bayer [EMAIL PROTECTED]: On Aug 31, 2008, at 4:44 PM, Eric Lemoine wrote: Hello Here's my case. I have 3 tables, summits, parkings, and huts. They all have an elevation column. And I want

[sqlalchemy] seeking advice for multi-table query

2008-08-31 Thread Eric Lemoine
Hello Here's my case. I have 3 tables, summits, parkings, and huts. They all have an elevation column. And I want to do queries like that: the summits, parkings, and huts that are higher than 2000 meters, the summits that are lower than 1000 meters, the parkings and huts that are between 500 and

[sqlalchemy] Re: composites

2008-08-21 Thread Eric Lemoine
Mike, a question related to you saying composites aren't a necessary feature in the first place. Would it be possible using just Python properties and synonym() to do something similar to the composites example in the doc, namely query(Vertex).filter(Vertex.start == Point(3, 4))? Thanks. Eric

[sqlalchemy] Re: composites

2008-08-21 Thread Eric Lemoine
Just realized that my question is similar to az's :) Eric 2008/8/21, Eric Lemoine [EMAIL PROTECTED]: Mike, a question related to you saying composites aren't a necessary feature in the first place. Would it be possible using just Python properties and synonym() to do something similar

[sqlalchemy] srid autodiscovery mechanism

2008-07-13 Thread Eric Lemoine
Hello I created my own type, Geometry, to deal with PostGIS' geometry column type. class Geometry(TypeEngine): def __init__(self, srid=-1, dims=2): super(Geometry, self).__init__() self.srid = srid self.dims = dims def get_col_spec(self): return

[sqlalchemy] autoload=True and asdecimal=False

2008-07-11 Thread Eric Lemoine
Hello When using autoload the created Numeric columns have asdecimal set to True (I use postgres, dunno if it's different with other databases). If would like that they have asdecimal set to False. Can I force that without having to override the results of the autoload with explicit

[sqlalchemy] autoload primary key

2008-07-11 Thread Eric Lemoine
Hello Are there particular conditions for the autoload mechanism to discover the primary key. If I remove Line 12 of this code http://paste.turbogears.org/paste/3183, I get this traceback http://paste.turbogears.org/paste/3182. Thanks a lot, -- Eric

[sqlalchemy] Re: autoload primary key

2008-07-11 Thread Eric Lemoine
On Fri, Jul 11, 2008 at 11:00 PM, Michael Bayer [EMAIL PROTECTED] wrote: ive never observed a scenario where SQLA could not reflect the primary key status of a column. Feel free to share wtih us what database youre using and the exact DDL used to generate the table in question. Well, the

[sqlalchemy] synonyms question

2008-07-07 Thread Eric Lemoine
Hello To override attribute behavior the 0.5 doc gives this example: class MyAddress(object): def _set_email(self, email): self._email = email def _get_email(self): return self._email email = property(_get_email, _set_email) mapper(MyAddress, addresses_table, properties =

[sqlalchemy] Re: synonyms question

2008-07-07 Thread Eric Lemoine
On Mon, Jul 7, 2008 at 10:24 PM, Michael Bayer [EMAIL PROTECTED] wrote: On Jul 7, 2008, at 3:29 PM, Eric Lemoine wrote: Hello To override attribute behavior the 0.5 doc gives this example: class MyAddress(object): def _set_email(self, email): self._email = email def

[sqlalchemy] Re: synonyms question

2008-07-07 Thread Eric Lemoine
On Mon, Jul 7, 2008 at 11:51 PM, Michael Bayer [EMAIL PROTECTED] wrote: On Jul 7, 2008, at 5:46 PM, Eric Lemoine wrote: without synonym(), just add _email:addresses_table.c.email to your mapper properties dict so that the email name is made available. In that case, on DB read, SA will set

[sqlalchemy] Re: PostgreSQL and inserting

2008-06-09 Thread Eric Lemoine
Hi. Currently sa does select after insert to get the new serial value? Is my understanding correct? Thx 2008/6/7, Michael Bayer [EMAIL PROTECTED]: On Jun 6, 2008, at 9:11 PM, Cliff Wells wrote: Just an FYI, in PostgreSQL 8.2.4 they added a new feature returning which can be used to avoid

[sqlalchemy] table union through ORM

2008-05-06 Thread Eric Lemoine
Hello Here's my thing: I have two DB tables, refugees and offices, which are independent tables (no foreign key). I already have two mappers for those tables: mapper(Refugee, refugees_table) mapper(Office, offices_table) In addition to being able to do independent queries on each table, I'd

[sqlalchemy] Re: table union through ORM

2008-05-06 Thread Eric Lemoine
On Tue, May 6, 2008 at 4:24 PM, Michael Bayer [EMAIL PROTECTED] wrote: On May 6, 2008, at 7:49 AM, Eric Lemoine wrote: Hello Here's my thing: I have two DB tables, refugees and offices, which are independent tables (no foreign key). I already have two mappers for those

[sqlalchemy] Re: table union through ORM

2008-05-06 Thread Eric Lemoine
Thanks a lot. I'll try that 2008/5/6, Michael Bayer [EMAIL PROTECTED]: On May 6, 2008, at 11:13 AM, Eric Lemoine wrote: In the Concrete Table Inheritance example in the doc, there's an employee table. In my case, there's no location table, and that's why I haven't seen Concrete Table

[sqlalchemy] Re: table union through ORM

2008-05-06 Thread Eric Lemoine
On Tue, May 6, 2008 at 5:36 PM, Eric Lemoine [EMAIL PROTECTED] wrote: Thanks a lot. I'll try that It works great! I would never have found how to do it without support from you Michael. The doc wasn't explicit enough for me to figure it out by myself. But support on the mailing list is awesome

[sqlalchemy] Re: sequence-related question

2008-05-02 Thread Eric Lemoine
Michael, yes, i think the seq is automatically executed in that case. Regarding the usage of currval i dunno. Sorry 2008/4/30, Michael Bayer [EMAIL PROTECTED]: On Apr 30, 2008, at 3:45 PM, Eric Lemoine wrote: With psycopg2, I know people using this: sql = INSERT INTO \%s\ (%s) VALUES

[sqlalchemy] sequence-related question

2008-04-30 Thread Eric Lemoine
Hello I insert a new line in a table using this: campfacility = Campfacility(prop1, prop2) model.Session.save(campfacility) model.Session.commit() The campfacility id is handled by a postgres sequence. What I'd like to do is: campfacility = Campfacility(prop1, prop2) seq =

[sqlalchemy] Re: sequence-related question

2008-04-30 Thread Eric Lemoine
On Wed, Apr 30, 2008 at 9:02 PM, Michael Bayer [EMAIL PROTECTED] wrote: On Apr 30, 2008, at 12:56 PM, Eric Lemoine wrote: thread 1 thread 2 execute(seq) - nextid = n execute(seq) - nextid = n model.Session.save

[sqlalchemy] Re: sequence-related question

2008-04-30 Thread Eric Lemoine
On Wed, Apr 30, 2008 at 9:02 PM, Michael Bayer [EMAIL PROTECTED] wrote: On Apr 30, 2008, at 12:56 PM, Eric Lemoine wrote: thread 1 thread 2 execute(seq) - nextid = n execute(seq) - nextid = n model.Session.save

[sqlalchemy] Re: sequence-related question

2008-04-30 Thread Eric Lemoine
On Wed, Apr 30, 2008 at 9:23 PM, Eric Lemoine [EMAIL PROTECTED] wrote: On Wed, Apr 30, 2008 at 9:02 PM, Michael Bayer [EMAIL PROTECTED] wrote: On Apr 30, 2008, at 12:56 PM, Eric Lemoine wrote: thread 1 thread 2

[sqlalchemy] Re: sequence-related question

2008-04-30 Thread Eric Lemoine
On Wed, Apr 30, 2008 at 9:44 PM, Michael Bayer [EMAIL PROTECTED] wrote: On Apr 30, 2008, at 3:23 PM, Eric Lemoine wrote: Yes, the sequence is my table's PK. What I want to know is the PK value of the line I'm going to insert (or I've just inserted). So I guess this is indeed

[sqlalchemy] Re: what happens on save?

2008-04-28 Thread Eric Lemoine
Thanks Michael for the detailed explanations and the patch. This is really helping! 2008/4/26, Michael Bayer [EMAIL PROTECTED]: On Apr 25, 2008, at 4:21 PM, Eric Lemoine wrote: Module sqlalchemy.orm.mapper:1198 in _postfetch elif not c.primary_key and c.key in params and self

[sqlalchemy] what happens on save?

2008-04-25 Thread Eric Lemoine
Hello I have the following code in my pylons app: refugee = Refugee(value, geometry) model.Session.save(refugee) model.Session.commit() Refugee is the class mapped to my Table object (refugees_table). geometry is an instance of a custom type, for which I created a Geometry(TypeEngine) class.

[sqlalchemy] Re: what happens on save?

2008-04-25 Thread Eric Lemoine
On Fri, Apr 25, 2008 at 5:55 PM, Michael Bayer [EMAIL PROTECTED] wrote: On Apr 25, 2008, at 11:37 AM, Eric Lemoine wrote: Hello I have the following code in my pylons app: refugee = Refugee(value, geometry) model.Session.save(refugee) model.Session.commit

[sqlalchemy] Re: what happens on save?

2008-04-25 Thread Eric Lemoine
On Fri, Apr 25, 2008 at 8:48 PM, Eric Lemoine [EMAIL PROTECTED] wrote: On Fri, Apr 25, 2008 at 5:55 PM, Michael Bayer [EMAIL PROTECTED] wrote: On Apr 25, 2008, at 11:37 AM, Eric Lemoine wrote: Hello I have the following code in my pylons app: refugee

[sqlalchemy] alias in mapping

2008-04-21 Thread Eric Lemoine
Hello I'm trying to use the key argument in my mapping: refugees_table = Table('refugee', MetaData(config['pylons.g'].sa_unhcr_webgis_engine), Column('refugee_fid', types.Integer, primary_key=True), Column('id', types.Float, key='_id'), autoload=True, schema='hqmap') But I

[sqlalchemy] Re: alias in mapping

2008-04-21 Thread Eric Lemoine
On Mon, Apr 21, 2008 at 10:37 AM, Eric Lemoine [EMAIL PROTECTED] wrote: Hello I'm trying to use the key argument in my mapping: refugees_table = Table('refugee', MetaData(config['pylons.g'].sa_unhcr_webgis_engine), Column('refugee_fid', types.Integer, primary_key=True

[sqlalchemy] Re: alias in mapping

2008-04-21 Thread Eric Lemoine
On Mon, Apr 21, 2008 at 5:17 PM, Michael Bayer [EMAIL PROTECTED] wrote: On Apr 21, 2008, at 4:37 AM, Eric Lemoine wrote: Hello I'm trying to use the key argument in my mapping: refugees_table = Table('refugee', MetaData(config['pylons.g'].sa_unhcr_webgis_engine

[sqlalchemy] access mapped object attributes

2007-11-05 Thread Eric Lemoine
Hello Have a question related to mapped objects and reflecting tables. If have this simple configuration: messages = Table('messages', meta, autoload=True) class Message(object): pass mapper(Message, messages) Given a Message object, do I have a way to retrieve all the attributes that

[sqlalchemy] Re: access mapped object attributes

2007-11-05 Thread Eric Lemoine
On 11/5/07, Paul Johnston [EMAIL PROTECTED] wrote: Hi, Given a Message object, do I have a way to retrieve all the attributes that result from the database mapping? Try this: for col in Message.c: It works. thanks a lot Paul, -- Eric

[sqlalchemy] RuntimeWarning with overriden reflected table

2007-10-10 Thread Eric Lemoine
Hi I use a reflected table with an overriden column: summits_table = Table('sommets_out', MetaData(config['pylons.g'].sa_search_engine), Column('geom', Geometry), autoload=True) and I get RuntimeWarning when accessing the table:

[sqlalchemy] Re: RuntimeWarning with overriden reflected table

2007-10-10 Thread Eric Lemoine
On 10/10/07, Michael Bayer [EMAIL PROTECTED] wrote: On Oct 10, 2007, at 10:01 AM, Eric Lemoine wrote: Hi I use a reflected table with an overriden column: summits_table = Table('sommets_out', MetaData(config['pylons.g'].sa_search_engine), Column('geom

  1   2   >