(self, src_db, dst_db)
Make sure client_encoding is same on both side.
Make sure client_encoding is same on both side.
Make sure client_encoding is same on both side .
def sync_database_encodings(self, src_db, dst_db):
        """Make sure client_encoding is same on both side."""

        try:
            # psycopg2
            if src_db.encoding != dst_db.encoding:
                dst_db.set_client_encoding(src_db.encoding)
        except AttributeError:
            # psycopg1
            src_curs = src_db.cursor()
            dst_curs = dst_db.cursor()
            src_curs.execute("show client_encoding")
            src_enc = src_curs.fetchone()[0]
            dst_curs.execute("show client_encoding")
            dst_enc = dst_curs.fetchone()[0]
            if src_enc != dst_enc:
                dst_curs.execute("set client_encoding = %s", [src_enc])
def sync_database_encodings ( self , src_db , dst_db ) : try : # psycopg2 if src_db . encoding != dst_db . encoding : dst_db . set_client_encoding ( src_db . encoding ) except AttributeError : # psycopg1 src_curs = src_db . cursor ( ) dst_curs = dst_db . cursor ( ) src_curs . execute ( "show client_encoding" ) src_enc = src_curs . fetchone ( ) [ 0 ] dst_curs . execute ( "show client_encoding" ) dst_enc = dst_curs . fetchone ( ) [ 0 ] if src_enc != dst_enc : dst_curs . execute ( "set client_encoding = %s" , [ src_enc ] )