Revision 3084
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
1186 | 1186 |
if isinstance(col_indexes, list): col_indexes[0] = add_indexes_ # defer |
1187 | 1187 |
elif col_indexes: add_indexes_() # add now |
1188 | 1188 |
|
1189 |
def copy_table_struct(db, src, dest): |
|
1190 |
'''Creates a structure-only copy of a table. (Does not copy data.)''' |
|
1191 |
while True: |
|
1192 |
try: |
|
1193 |
create_table(db, dest, has_pkey=False, col_indexes=False, like=src) |
|
1194 |
break |
|
1195 |
except DuplicateException: |
|
1196 |
table.name = next_version(table.name) |
|
1197 |
# try again with next version of name |
|
1198 |
|
|
1189 | 1199 |
### Data |
1190 | 1200 |
|
1191 | 1201 |
def truncate(db, table, schema='public', **kw_args): |
Also available in: Unified diff
sql.py: Added copy_table_struct()