Skip to content

Commit

Permalink
Solved an error on "CREATE SERVER"
Browse files Browse the repository at this point in the history
Detail: inconsistent use of tabs and spaces in indentation (__init__.py, line 55)
Error: Error in python: TabError
  • Loading branch information
sjstoelting committed Mar 14, 2019
1 parent 879ef66 commit bc7bc6a
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions sparqlfdw/__init__.py
Expand Up @@ -52,7 +52,7 @@ def execute(self, quals, columns):
#log_to_postgres('yeld result line %s'%(str(line)))
yield line

log_to_postgres('sparqlfdw query finished',DEBUG)
log_to_postgres('sparqlfdw query finished',DEBUG)

except Exception as e:
log_to_postgres(str(e), ERROR)
Expand All @@ -61,28 +61,28 @@ def execute(self, quals, columns):
def json2column(self, result, column ):
''' result is for the moment in json format and column is ColumnDefinition objeect'''
try:

def json2text(result):
return result['value']

def json2json(result):
return json.dumps(result)

def json2int(result):
return int(result['value'])

def json2real(result):
return float(result['value'])

def json2timestamp(result):
return dateutil.parser.parse(result['value'])

def json2time(result):
return (dateutil.parser.parse(result['value']).time())

def json2timetz(result):
return (dateutil.parser.parse(result['value']).timetz())

transformFunction={
'json' : json2json,
'text' : json2text,
Expand All @@ -96,10 +96,9 @@ def json2timetz(result):
'timestamp with time zone' : json2timestamp,
'timestamp without time zone' : json2timestamp,
}

return transformFunction[column.base_type_name](result)

except Exception as e:
log_to_postgres('sparqlfdw error %s json2column( result %s column %s'%(str(e), result, column), ERROR)
raise

0 comments on commit bc7bc6a

Please sign in to comment.