Thanks, this sounds exactly like what I am looking to do.


On 2013-10-15 11:44 PM, Michael Bayer wrote:
On Oct 15, 2013, at 9:19 PM, Jonathan <[email protected]> wrote:

Hello,

I have a question about functions on columns in SQL Alchemy, and I can't seem 
to find where in the Docs for release 0.8 that this is covered.

I'm aware func.*() to run a function such as NOW() on either update or as a 
default on the column, but I am wondering how to setup a function on 
insert/update and another on select, such as using MySQL's INET6_ATON() and 
INET6_NTOA() to convert IP Addresses to network byte order and back.
I think you're asking for how the function can be called transparently on the 
insert/select side, e.g. without having to specify it manually, this feature is 
relatively new and is available via the bind_expression() and 
column_expression() methods on types, see the example at 
http://docs.sqlalchemy.org/en/rel_0_8/core/types.html#types-sql-value-processing
 which illustrates a very similar operation using PG's ST_GeomFromText and 
ST_AsText (you can pretty much swap in the INET6 functions here).

        

--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to