@@ -164,7 +164,7 @@ def unionSELECT(selectComponents, distinct=False, selectType=TRIPLE_SELECT):
164
164
elif tableType == ASSERTED_TYPE_PARTITION :
165
165
selectClause = expression .select (
166
166
[table .c .member .label ('subject' ),
167
- expression .literal (RDF .type ).label ('predicate' ),
167
+ expression .literal (str ( RDF .type ) if PY3 else unicode ( RDF . type ) ).label ('predicate' ),
168
168
table .c .klass .label ('object' ),
169
169
table .c .context .label ('context' ),
170
170
table .c .termComb .label ('termcomb' ),
@@ -296,7 +296,7 @@ class TermType(types.TypeDecorator):
296
296
297
297
def process_bind_param (self , value , dialect ):
298
298
if isinstance (value , (QuotedGraph , Graph )):
299
- return value .identifier
299
+ return str ( value .identifier ) if PY3 else unicode ( value . identifier )
300
300
elif isinstance (value , Node ):
301
301
return str (value ) if PY3 else unicode (value )
302
302
else :
@@ -581,6 +581,7 @@ def open(self, configuration, create=True):
581
581
exists, but there is insufficient permissions to open the
582
582
store."""
583
583
name , opts = _parse_rfc1738_args (configuration )
584
+
584
585
self .engine = sqlalchemy .create_engine (configuration )
585
586
with self .engine .connect () as connection :
586
587
if create :
@@ -1170,6 +1171,7 @@ def prefix(self, namespace):
1170
1171
""" """
1171
1172
with self .engine .connect () as connection :
1172
1173
nb_table = self .tables ['namespace_binds' ]
1174
+ namespace = str (namespace ) if PY3 else unicode (namespace )
1173
1175
s = select ([nb_table .c .prefix ]).where (nb_table .c .uri == namespace )
1174
1176
res = connection .execute (s )
1175
1177
rt = [rtTuple [0 ] for rtTuple in res .fetchall ()]
@@ -1179,10 +1181,11 @@ def prefix(self, namespace):
1179
1181
def namespace (self , prefix ):
1180
1182
""" """
1181
1183
res = None
1184
+ prefix_val = str (prefix ) if PY3 else unicode (prefix )
1182
1185
try :
1183
1186
with self .engine .connect () as connection :
1184
1187
nb_table = self .tables ['namespace_binds' ]
1185
- s = select ([nb_table .c .uri ]).where (nb_table .c .prefix == prefix )
1188
+ s = select ([nb_table .c .uri ]).where (nb_table .c .prefix == prefix_val )
1186
1189
res = connection .execute (s )
1187
1190
rt = [rtTuple [0 ] for rtTuple in res .fetchall ()]
1188
1191
res .close ()
0 commit comments