Revision 3750
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql_gen.py | ||
---|---|---|
313 | 313 |
if for_str: str_ = clean_name(str_) |
314 | 314 |
if self.table != None: |
315 | 315 |
table = self.table.to_Table() |
316 |
if for_str: str_ = concat(str(table), '.'+str_) |
|
316 |
if for_str: str_ = concat(strings.ustr(table), '.'+str_)
|
|
317 | 317 |
else: str_ = table.to_str(db)+'.'+str_ |
318 | 318 |
return str_ |
319 | 319 |
|
lib/sql.py | ||
---|---|---|
469 | 469 |
cols = [type_, 'column_default', |
470 | 470 |
sql_gen.Cast('boolean', sql_gen.Col('is_nullable'))] |
471 | 471 |
|
472 |
conds = [('table_name', col.table.name), ('column_name', col.name)] |
|
472 |
conds = [('table_name', col.table.name), |
|
473 |
('column_name', strings.ustr(col.name))] |
|
473 | 474 |
schema = col.table.schema |
474 | 475 |
if schema != None: conds.append(('table_schema', schema)) |
475 | 476 |
|
... | ... | |
584 | 585 |
''' |
585 | 586 |
kw_args.setdefault('log_level', 4) |
586 | 587 |
|
587 |
return strings.join_lines(values(run_query(db, 'EXPLAIN '+query,
|
|
588 |
recover=True, cacheable=True, **kw_args)))
|
|
588 |
return strings.ustr(strings.join_lines(values(run_query(db,
|
|
589 |
'EXPLAIN '+query, recover=True, cacheable=True, **kw_args))))
|
|
589 | 590 |
# not a higher log_level because it's useful to see what query is being |
590 | 591 |
# run before it's executed, which EXPLAIN effectively provides |
591 | 592 |
|
... | ... | |
976 | 977 |
preserve = set(preserve) |
977 | 978 |
for col in cols: |
978 | 979 |
if col not in preserve: |
979 |
items.append((col, sql_gen.Col(str(col), into, col.srcs))) |
|
980 |
items.append((col, sql_gen.Col(strings.ustr(col), into, col.srcs)))
|
|
980 | 981 |
|
981 | 982 |
if not as_items: items = dict(items) |
982 | 983 |
return items |
lib/sql_io.py | ||
---|---|---|
112 | 112 |
srcs = col.srcs |
113 | 113 |
save_errors = errors_table != None and srcs |
114 | 114 |
if save_errors: # function will be unique for the given srcs |
115 |
function_name = str(sql_gen.FunctionCall(function_name, |
|
115 |
function_name = strings.ustr(sql_gen.FunctionCall(function_name,
|
|
116 | 116 |
*map(sql_gen.to_name_only_col, srcs))) |
117 | 117 |
function = db.TempFunction(function_name) |
118 | 118 |
|
... | ... | |
166 | 166 |
|
167 | 167 |
# Add column |
168 | 168 |
new_typed_col = sql_gen.TypedCol(new_col.name, type_) |
169 |
sql.add_col(db, table, new_typed_col, comment=repr(col)+'::'+type_) |
|
169 |
sql.add_col(db, table, new_typed_col, comment=strings.urepr(col)+'::'+type_)
|
|
170 | 170 |
new_col.name = new_typed_col.name # propagate any renaming |
171 | 171 |
|
172 | 172 |
sql.update(db, table, [(new_col, expr)], in_place=True, recover=True) |
... | ... | |
213 | 213 |
if table == in_tables0: |
214 | 214 |
in_col = sql_gen.to_name_only_col(in_col) |
215 | 215 |
elif is_func_result(in_col): in_col = table # omit col name |
216 |
return str(in_col) |
|
216 |
return strings.ustr(in_col)
|
|
217 | 217 |
|
218 | 218 |
str_ = str(out_table) |
219 | 219 |
if is_func: |
Also available in: Unified diff
Use strings.ustr() or strings.urepr() everywhere that columns are stringified, in order to support column names with non-ASCII characters (such as in the Madidi data)