-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi.

I have written a small class in order to support PostgreSQL tsearch type:

class TextSearchVector(UserDefinedType):
    """Support for full-text search
    See
    http://www.postgresql.org/docs/8.4/static/datatype-textsearch.html
    """

     def get_col_spec(self):
        return 'tsvector'


The problem with this code is that a string is converted to a tsearch
type without first normalizing it; this can also cause a syntax error.

The solution is to use the `to_tsearch` function.

In SQL (tested with PostgreSQL and SQLite, at least) I can do:
INSERT INTO test (text) values(to_tsvector('some text'));

That is, it is possible to specify a scalar select statement for each value.


Is this possible to do with SQLAlchemy?

It seems to me that it is not possible.
It is not possible to specify an SQL scalar select statement in a custom
type bind_processor method, and it is not possible to specify an SQL
scalar select statement in an insert statement.

Can this be solved using SQLAlchemy?
Or should I simply use triggers?


Thanks  Manlio
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAktoc0IACgkQscQJ24LbaUQ/EgCeIKThU9dV8DZT0qampIR1iHRx
bP4AoI1/DPoEXRyewZGHLs6LF8DdCRZp
=YKtw
-----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 sqlalch...@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