Hi Audrius,

How about this: 
>
>   q = db_session.query(func.regexp_split_to_array( 
>       func.substring(Point.data, r'^POINT\((.*)\)$'), r'\s')) 
>   for row in q: 
>       print row 
>
>   q = db_session.query(cast(func.regexp_split_to_table( 
>       func.substring(Point.data, r'^POINT\((.*)\)$'), r'\s'), Float)) 
>   for row in q: 
>       print row 
>

That works! Thank you very much!
But somehow I am a little bit worried about the performance. Wouldn't 
trim() be much faster than regex? (I need to do this quite a lot of times)
 

> Although I'm not familiar with this stuff, but perhaps this would be 
> better suited for PostGIS and GeoAlchemy?  
>

Actually, I am using PostGIS+GeoAlchemy2, but due to my data-format there 
is no function available which can extract the coordinates from the object. 
Only the String-representation, which is of the format shown above (Yes, 
this is VERY annoying.)

Cheers

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sqlalchemy/-/KCFzSi_afJwJ.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to