[storm] Should storm have separate String and Blob datatypes?

James Henstridge james at jamesh.id.au
Tue Jun 30 16:36:44 BST 2009


On Tue, Jun 30, 2009 at 9:42 PM, Jason Baker<jbaker at zeomega.com> wrote:
> Apologies if I'm being dense, but I just want to make sure that I'm
> absolutely clear on this.  Oracle relies on having binary data
> hexlified.  If it's passed as a bind variable, then this has to be
> done on the Python side.  Therefore, if the back end encounters a
> RawStr variable, it is safe to assume that it should always be
> hexlified before sending it to the database?  Conversely, a person
> using Storm should assume that a RawStr *should not* be used to access
> textual data?

That is correct.  The Postgres backend handles conversion of values
going into the DB with the following snippet from
PostgresConnection.to_database():

    def to_database(self, params):
        for param in params:
            ...
            elif isinstance(param, str):
                yield psycopg2.Binary(param)

If you need to do any fixups on the values returned by the database
adapter, you can use a subclass of storm.database.Result and override
from_database() like the mysql backend does.

James.



More information about the storm mailing list