fix headers in SQLTABLE to handle quoted entities
This commit is contained in:
1 parent
dcd92daa24
commit
5f636c5ba2
1 file changed
+5
-2
+5
-2
@@ -2913,13 +2913,14 @@ class SQLTABLE(TABLE):
|
|||||||
(components, row) = (self.components, [])
|
(components, row) = (self.components, [])
|
||||||
if not sqlrows:
|
if not sqlrows:
|
||||||
return
|
return
|
||||||
|
REGEX_TABLE_DOT_FIELD = sqlrows.db._adapter.REGEX_TABLE_DOT_FIELD
|
||||||
if not columns:
|
if not columns:
|
||||||
REGEX_TABLE_DOT_FIELD = sqlrows.db._adapter.REGEX_TABLE_DOT_FIELD
|
|
||||||
columns = [c for c in sqlrows.colnames if REGEX_TABLE_DOT_FIELD.match(c)]
|
columns = [c for c in sqlrows.colnames if REGEX_TABLE_DOT_FIELD.match(c)]
|
||||||
if headers == 'fieldname:capitalize':
|
if headers == 'fieldname:capitalize':
|
||||||
headers = {}
|
headers = {}
|
||||||
for c in columns:
|
for c in columns:
|
||||||
headers[c] = c.split('.')[-1].replace('_', ' ').title()
|
(t,f) = REGEX_TABLE_DOT_FIELD.match(c).groups()
|
||||||
|
headers[t + '.' + f] = f.replace('_', ' ').title()
|
||||||
elif headers == 'labels':
|
elif headers == 'labels':
|
||||||
headers = {}
|
headers = {}
|
||||||
for c in columns:
|
for c in columns:
|
||||||
@@ -2938,6 +2939,7 @@ class SQLTABLE(TABLE):
|
|||||||
headers = {}
|
headers = {}
|
||||||
else:
|
else:
|
||||||
for c in columns: # new implement dict
|
for c in columns: # new implement dict
|
||||||
|
c = '.'.join(REGEX_TABLE_DOT_FIELD.match(c).groups())
|
||||||
if isinstance(headers.get(c, c), dict):
|
if isinstance(headers.get(c, c), dict):
|
||||||
coldict = headers.get(c, c)
|
coldict = headers.get(c, c)
|
||||||
attrcol = dict()
|
attrcol = dict()
|
||||||
@@ -2987,6 +2989,7 @@ class SQLTABLE(TABLE):
|
|||||||
raise KeyError(
|
raise KeyError(
|
||||||
"Column %s not found (SQLTABLE)" % colname)
|
"Column %s not found (SQLTABLE)" % colname)
|
||||||
(tablename, fieldname) = matched_column_field.groups()
|
(tablename, fieldname) = matched_column_field.groups()
|
||||||
|
colname = tablename + '.' + fieldname
|
||||||
try:
|
try:
|
||||||
field = sqlrows.db[tablename][fieldname]
|
field = sqlrows.db[tablename][fieldname]
|
||||||
except (KeyError, AttributeError):
|
except (KeyError, AttributeError):
|
||||||
|
|||||||
Reference in new issue
Block a user