Project

General

Profile

« Previous | Next » 

Revision 5023

db_xml.py: put_table(): Subsetting in_table: Copy all of in_table's structure, rather than just the column types, by using sql.copy_table_struct() and sql.insert_select(). This preserves pkeys and NOT NULL constraints, which are useful for column-based import.

View differences:

lib/db_xml.py
215 215
        # Subset in_table
216 216
        in_table = sql_gen.Table(strings.ustr(full_in_table),
217 217
            srcs=full_in_table.srcs, is_temp=True) # prepend schema to name
218
        cur = sql.run_query_into(db, sql.mk_select(db, full_in_table,
219
            limit=this_limit, start=start), into=in_table, add_pkey_=True)
218
        sql.copy_table_struct(db, full_in_table, in_table)
219
        cur = sql.insert_select(db, in_table, None, sql.mk_select(db,
220
            full_in_table, limit=this_limit, start=start))
220 221
        
221 222
        this_ct = cur.rowcount
222 223
        total += this_ct

Also available in: Unified diff