Project

General

Profile

« Previous | Next » 

Revision 4436

sql_io.py: Added mk_errors_table()

View differences:

lib/sql_io.py
187 187
    if if_exists and not sql.table_exists(db, errors_table): return None
188 188
    return errors_table
189 189

  
190
def mk_errors_table(db, table):
191
    errors_table_ = errors_table(db, table, if_exists=False)
192
    if sql.table_exists(db, errors_table_): return
193
    
194
    typed_cols = [
195
        sql_gen.TypedCol('column', 'text', nullable=False),
196
        sql_gen.TypedCol('value', 'text'),
197
        sql_gen.TypedCol('error_code', 'character varying(5)', nullable=False),
198
        sql_gen.TypedCol('error', 'text', nullable=False),
199
        ]
200
    sql.create_table(db, errors_table_, typed_cols, has_pkey=False)
201
    index_cols = ['column', 'value', 'error_code', 'error']
202
    sql.add_index(db, index_cols, errors_table_, unique=True)
203

  
190 204
##### Import
191 205

  
192 206
def put(db, table, row, pkey_=None, row_ct_ref=None):

Also available in: Unified diff