Revision 2732
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
709 | 709 |
elif module == 'MySQLdb': return db.insert_id() |
710 | 710 |
else: return None |
711 | 711 |
|
712 |
def truncate(db, table, schema='public'): |
|
713 |
return run_query(db, 'TRUNCATE '+qual_name(db, schema, table)+' CASCADE') |
|
714 |
|
|
715 | 712 |
def mk_flatten_mapping(db, into, cols, preserve=[], as_items=False): |
716 | 713 |
'''Creates a mapping from original column names (which may have collisions) |
717 | 714 |
to names that will be distinct among the columns' tables. |
... | ... | |
1002 | 999 |
db.with_autocommit(lambda: run_query(db, 'VACUUM ANALYZE '+table.to_str(db), |
1003 | 1000 |
log_level=3)) |
1004 | 1001 |
|
1002 |
def truncate(db, table, schema='public'): |
|
1003 |
return run_query(db, 'TRUNCATE '+qual_name(db, schema, table)+' CASCADE') |
|
1004 |
|
|
1005 | 1005 |
def tables(db, schema_like='public', table_like='%', exact=False): |
1006 | 1006 |
if exact: compare = '=' |
1007 | 1007 |
else: compare = 'LIKE' |
Also available in: Unified diff
sql.py: Moved truncate() to Database structure queries section