Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Unicode support for psycopg2 native hstore implementation #2

Closed
wants to merge 1 commit into from

2 participants

@dmugtasimov

This is draft pull request for unicode support for psycopg2 native hstore implementation. You would probably expect unittests for this and may be unicode support for non-native hstore support. Please, point this out and I will fix pull request.

I will also add some comments about unclear points in the source code.

@dmugtasimov dmugtasimov commented on the diff
lib/sqlalchemy/dialects/postgresql/psycopg2.py
@@ -393,7 +393,8 @@ def on_connect(conn):
hstore_oids = self._hstore_oids(conn)
if hstore_oids is not None:
oid, array_oid = hstore_oids
- extras.register_hstore(conn, oid=oid, array_oid=array_oid)
+ extras.register_hstore(conn, oid=oid, array_oid=array_oid,
+ unicode=True)

I am not sure if unicode=True should be hardcoded like this, probably some extra parameter should be used like use_hstore_unicode in __init__()

@zzzeek Owner
zzzeek added a note

well we have a param already called use_native_unicode, which has the effect of using psycopg2.extensions.UNICODE, and this param is generally set. Though im not quite sure we should link to hstore, does this prevent binary data from being retrieved from the hstore ? or perhaps, what's the behavior with the non-native hstore, do we return unicode in that implementation? ( I didn't write it, would have to check)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@zzzeek
Owner

well its in here: 8fecf4b there's some other changes surrounding it, tests, non-psycopg2 support, etc.

thanks !

@zzzeek zzzeek closed this
@dmugtasimov

Thank you! I see you have done a lot of work for it that one would probably expect from me.

@zzzeek zzzeek referenced this pull request from a commit
Mike Bayer Merged in goodscloud/sqlalchemy (pull request #2)
don't create a history entry when an object in a backref has changed
6b51923
@zzzeek zzzeek referenced this pull request from a commit
Mike Bayer Merged in goodscloud/sqlalchemy (pull request #2)
don't create a history entry when an object in a backref has changed
6286f71
@sqla-tester sqla-tester referenced this pull request from a commit in sqla-tester/sqlalchemy
@zzzeek - code change #2 58aa133
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 1 deletion.
  1. +2 −1  lib/sqlalchemy/dialects/postgresql/psycopg2.py
View
3  lib/sqlalchemy/dialects/postgresql/psycopg2.py
@@ -393,7 +393,8 @@ def on_connect(conn):
hstore_oids = self._hstore_oids(conn)
if hstore_oids is not None:
oid, array_oid = hstore_oids
- extras.register_hstore(conn, oid=oid, array_oid=array_oid)
+ extras.register_hstore(conn, oid=oid, array_oid=array_oid,
+ unicode=True)

I am not sure if unicode=True should be hardcoded like this, probably some extra parameter should be used like use_hstore_unicode in __init__()

@zzzeek Owner
zzzeek added a note

well we have a param already called use_native_unicode, which has the effect of using psycopg2.extensions.UNICODE, and this param is generally set. Though im not quite sure we should link to hstore, does this prevent binary data from being retrieved from the hstore ? or perhaps, what's the behavior with the non-native hstore, do we return unicode in that implementation? ( I didn't write it, would have to check)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
fns.append(on_connect)
if fns:
Something went wrong with that request. Please try again.