psqlextra/expressions.py
def as_sql(self, compiler, connection):
        """Compiles the HStore value into SQL.

        Compiles expressions contained in the values
        of HStore entries as well.

        Given a dictionary like:

            dict(key1='val1', key2='val2')

        The resulting SQL will be:

            hstore(hstore('key1', 'val1'), hstore('key2', 'val2'))
        """

        result = []
        for key, value in self.value.items():
            if hasattr(value, 'as_sql'):
                sql, params = value.as_sql(compiler, connection)
                result.append('hstore(\'%s\', %s)' % (
                    key, sql % params))
            elif value is not None:
                result.append('hstore(\'%s\', \'%s\')' % ((
                    key, value)))
            else:
                result.append('hstore(\'%s\', NULL)' % key)

        return '%s' % ' || '.join(result), []
def as_sql(self, compiler, connection):
        """Compiles the HStore value into SQL.

        Compiles expressions contained in the values
        of HStore entries as well.

        Given a dictionary like:

            dict(key1='val1', key2='val2')

        The resulting SQL will be:

            hstore(hstore('key1', 'val1'), hstore('key2', 'val2'))
        """

        result = []
        for key, value in self.value.items():
            if hasattr(value, 'as_sql'):
                sql, params = value.as_sql(compiler, connection)
                result.append('hstore(\'%s\', %s)' % (
                    key, sql % params))
            elif value is not None:
                result.append('hstore(\'%s\', \'%s\')' % ((
                    key, value)))
            else:
                result.append('hstore(\'%s\', NULL)' % key)

        return '%s' % ' || '.join(result), []
Compiles the HStore value into SQL.

        Compiles expressions contained in the values
        of HStore entries as well.

        Given a dictionary like:

            dict(key1='val1', key2='val2')

        The resulting SQL will be:

            hstore(hstore('key1', 'val1'), hstore('key2', 'val2'))