Re: [sqlalchemy] Postgres custom composite types

2013-03-27 Thread Tobias Bieniek
GeoAlchemy is for SQLALchemy =0.7.x GeoAlchemy2 if for SQLALchemy =0.8 Kamil is mostly right. GeoAlchemy2 v0.1 is published on PyPI now, and GeoAlchemy(1) is also still available. The latter is still compatible with SQLAlchemy 0.8 though, but GeoAlchemy2 has a much easier code base and

Re: [sqlalchemy] Postgres custom composite types

2013-03-26 Thread Michael Bayer
well .key on any ColumnElement is supposed to be a string name that Query and others will call upon to assign it a label in the result set. removing .key, which is unneeded, allows it to work (note expr.clauses): class PGCompositeElement(expression.FunctionElement): def __init__(self,

Re: [sqlalchemy] Postgres custom composite types

2013-03-26 Thread Tobias Bieniek
Hi Michael, thanks for the explanation on the key attribute. I ended up misunderstanding it at first, but it seems to work now. I had a few problems when I tried to use a UserDefinedType (e.g. geoalchemys Geometry) in the typemap, because it complained about a missing key attribute. I've

Re: [sqlalchemy] Postgres custom composite types

2013-03-26 Thread Michael Bayer
On Mar 26, 2013, at 7:59 PM, Tobias Bieniek tobias.bien...@googlemail.com wrote: Hi Michael, thanks for the explanation on the key attribute. I ended up misunderstanding it at first, but it seems to work now. I had a few problems when I tried to use a UserDefinedType (e.g. geoalchemys

Re: [sqlalchemy] Postgres custom composite types

2013-03-26 Thread Kamil Gałuszka
As far I'm concerned: GeoAlchemy is for SQLALchemy =0.7.x GeoAlchemy2 if for SQLALchemy =0.8 On PyPI is GeoAlchemy 2 version 0.1 working with sqlalchemy 0.8 With regards Kamil Gałuszka On Wednesday, March 27, 2013 1:17:49 AM UTC+1, Michael Bayer wrote: On Mar 26, 2013, at 7:59 PM, Tobias

Re: [sqlalchemy] Postgres custom composite types

2013-03-25 Thread Tobias Bieniek
*Sorry, just noticed that I replied directly, instead of to the list. Here are the contents for everyone:* Thanks for you help. Using the FunctionElement worked quite well, but I had to tweak the constructor and assign the base parameter to self.key to make it work properly (failing stack trace

Re: [sqlalchemy] Postgres custom composite types

2013-03-24 Thread Tobias Bieniek
I've tried to extract the basic structure from this sample code and merge it into the GeoAlchemy2 project, but somehow it fails to work for my specific use-case: https://github.com/geoalchemy/geoalchemy2/pull/18 I'm trying something like: select([func.SomeFunction(table.c.some_column,

Re: [sqlalchemy] Postgres custom composite types

2013-03-24 Thread Michael Bayer
if you can package up a script with full context that would help, that pullreq appears to add a new type to a file and I don't see how that results in anything happening. In general if you are using my recipe earlier that features ColumnElement, that object won't report on its parent table for

Re: [sqlalchemy] Postgres custom composite types

2013-03-24 Thread Tobias Bieniek
thanks for the quick reply! if you can package up a script with full context that would help, that pullreq appears to add a new type to a file and I don't see how that results in anything happening. you are right,

Re: [sqlalchemy] Postgres custom composite types

2013-03-24 Thread Michael Bayer
On Mar 24, 2013, at 5:54 PM, Tobias Bieniek tobias.bien...@googlemail.com wrote: could you point me in the right direction how to set it up correctly? I'm currently a bit lost in the documentation and code. just send me a standalone test script so I can see what you're trying to do

Re: [sqlalchemy] Postgres custom composite types

2013-03-24 Thread Tobias Bieniek
I've added a small standalone script at https://gist.github.com/Turbo87/5233888 The output is SELECT (SomeFunction(table.foo)).attr1 AS anon_1, without any FROM clause. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this

Re: [sqlalchemy] Postgres custom composite types

2013-03-24 Thread Michael Bayer
right, ColumnElement doesn't export the froms from it's expression by default. There's a method you can implement to do this, but here is another approach that doesn't use any private APIs: from sqlalchemy.sql.expression import FunctionElement class PGCompositeElement(FunctionElement): def

Re: [sqlalchemy] Postgres custom composite types

2013-03-05 Thread Michael Bayer
On Mar 5, 2013, at 9:45 AM, Jason ja...@deadtreepages.com wrote: Hello, I'm looking or some direction on how to implement the SQL syntax when querying Postgres' composite types. In case you're unfamiliar: the composite types in Postgres are a type that contains attributes which are

Re: [sqlalchemy] Postgres custom composite types

2013-03-05 Thread Jason
On Tuesday, March 5, 2013 11:09:00 AM UTC-5, Michael Bayer wrote: On Mar 5, 2013, at 9:45 AM, Jason ja...@deadtreepages.com javascript: wrote: Hello, I'm looking or some direction on how to implement the SQL syntax when querying Postgres' composite types. In case you're

Re: [sqlalchemy] Postgres custom composite types

2013-03-05 Thread Jason
On Tuesday, March 5, 2013 2:52:59 PM UTC-5, Jason wrote: On Tuesday, March 5, 2013 11:09:00 AM UTC-5, Michael Bayer wrote: On Mar 5, 2013, at 9:45 AM, Jason ja...@deadtreepages.com wrote: Hello, I'm looking or some direction on how to implement the SQL syntax when querying