Revision 1982
Added by Aaron Marcuse-Kubitza over 12 years ago
bin/map | ||
---|---|---|
94 | 94 |
out_db_config = get_db_config('out') |
95 | 95 |
in_is_db = 'engine' in in_db_config |
96 | 96 |
out_is_db = 'engine' in out_db_config |
97 |
in_schema = opts.get_env_var('in_schema', None, env_names) |
|
98 |
in_table = opts.get_env_var('in_table', None, env_names) |
|
97 | 99 |
|
98 | 100 |
## |
99 | 101 |
|
... | ... | |
243 | 245 |
ex_tracker.track(e) |
244 | 246 |
|
245 | 247 |
if in_is_db: |
246 |
assert in_is_xpaths
|
|
248 |
in_db = connect_db(in_db_config)
|
|
247 | 249 |
|
248 |
in_db = connect_db(in_db_config) |
|
249 |
cur = sql.select(in_db, table=in_root, limit=n, start=start) |
|
250 |
# Get table and schema name |
|
251 |
schema = in_schema # modified, so can't have same name as outer var |
|
252 |
table = in_table # modified, so can't have same name as outer var |
|
253 |
if table == None: |
|
254 |
assert in_is_xpaths |
|
255 |
schema, sep, table = in_root.partition('.') |
|
256 |
if sep == '': # only the table name was specified |
|
257 |
table = schema |
|
258 |
schema = None |
|
259 |
table_is_esc = False |
|
260 |
if schema != None: |
|
261 |
table = sql.qual_name(in_db, schema, table) |
|
262 |
table_is_esc = True |
|
263 |
|
|
264 |
cur = sql.select(in_db, table, limit=n, start=start, |
|
265 |
table_is_esc=table_is_esc) |
|
250 | 266 |
row_ct = map_table(list(sql.col_names(cur)), sql.rows(cur), |
251 | 267 |
rows_start=start) # rows_start: pre-start rows have been skipped |
252 | 268 |
|
Also available in: Unified diff
bin/map: Support custom schema name. Support input table/schema override via env vars, in case the map spreadsheet was written for a different input format.