-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Michael Bayer ha scritto:
> [...]
> 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?
>
> [...]
>> OK you mean SQL expression during compilation. This is ticket #1534
>> which is not yet implemented.
After some tests I got something that works
http://paste.pocoo.org/show/173099/
The documentation seems to confirm this:
http://www.sqlalchemy.org/docs/reference/sqlalchemy/expressions.html#sqlalchemy.sql.expression.insert
SQLAlchemy still continues to surprise me!
I need to download the documentation in PDF format, and take some time
study it.
I don't know if an example of this feature is available in the tutorial;
if not, it should be added.
>Right now you'd have to set attributes to
>> the to_tsvector() expression directly, note that the ORM and such accept
>> SQL expressions as values. Which means if you're dealing just with ORM,
>> you can use a @validates or similar (and maybe a comparator too) that
>> wraps incoming values into to_tsvector().
It is 4 years that I don't touch the ORM ;-).
The example in
>> examples/postgis/postgis.py illustrates these techniques.
>
Thanks Manlio
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAktogfkACgkQscQJ24LbaUSjwgCfevuSHb0YjMGNMFXhm+imJHqY
YSsAn1wypa/GG86TfGHMIGbFvf9lctVN
=eqiB
-----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.