Revision 3289
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql_io.py | ||
---|---|---|
306 | 306 |
pkeys_cols = [in_pkey_col, out_pkey_col] |
307 | 307 |
|
308 | 308 |
pkeys_table_exists_ref = [False] |
309 |
def insert_into_pkeys(joins, cols, distinct=False): |
|
310 |
kw_args = {}
|
|
311 |
if distinct: kw_args.update(dict(distinct_on=[in_pkey_col]))
|
|
312 |
query = sql.mk_select(db, joins, cols, order_by=None, start=0,
|
|
313 |
**kw_args)
|
|
309 |
def insert_into_pkeys(joins, cols, distinct=False, **kw_args):
|
|
310 |
distinct_on = []
|
|
311 |
if distinct: distinct_on=[in_pkey_col]
|
|
312 |
query = sql.mk_select(db, joins, cols, distinct_on=distinct_on,
|
|
313 |
order_by=None, start=0)
|
|
314 | 314 |
|
315 | 315 |
if pkeys_table_exists_ref[0]: |
316 |
sql.insert_select(db, into, pkeys_names, query) |
|
316 |
sql.insert_select(db, into, pkeys_names, query, **kw_args)
|
|
317 | 317 |
else: |
318 |
sql.run_query_into(db, query, into=into) |
|
318 |
sql.run_query_into(db, query, into=into, **kw_args)
|
|
319 | 319 |
pkeys_table_exists_ref[0] = True |
320 | 320 |
|
321 | 321 |
limit_ref = [None] |
Also available in: Unified diff
sql_io.py: put_table(): insert_into_pkeys(): Support custom query kw_args, such as recover