On Feb 1, 2010, at 8:31 PM, Manlio Perillo wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi.
>
> I have defined a custom type for PostgreSQL ltree support.
>
> The code is very simple (I'm using version from trunk):
>
> class LabelTree(UserDefinedType):
> def bind_processor(self, dialect):
> def process(value):
> assert '_' not in value
> assert '.' not in value
>
> return value.replace('-', '_').replace('/', '.')
>
> return process
>
> def result_processor(self, dialect, coltype=None):
> def process(value):
> return value.replace('_', '-').replace('.', '/')
>
> return process
>
> def get_col_spec(self):
> return 'ltree'
>
>
> This works, when I create the table and insert some values.
> However when I select data from the database, result_processor is not
> called.
nothing unusual above and UserDefinedType.result_processor is covered in tests
(which fail if I change result_processor, so its called), so you'll have to
provide more specifics.
>
> The database is PostgreSQL (psycopg2).
>
>
> Thanks Manlio
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iEYEARECAAYFAktngG0ACgkQscQJ24LbaUT4ngCfRbIr/haPhB4UoXtTDk5TJ11q
> /YYAn1NJ5rLgkjvXbMaf2TkDpvefBrTH
> =N6IO
> -----END PGP SIGNATURE-----
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/sqlalchemy?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.