Revision 4556
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
1067 | 1067 |
, cacheable=True, log_level=4)) |
1068 | 1068 |
else: raise NotImplementedError("Can't list tables for "+module+' database') |
1069 | 1069 |
|
1070 |
def table_exists(db, table): |
|
1070 |
def table_exists(db, table, cacheable=True):
|
|
1071 | 1071 |
table = sql_gen.as_Table(table) |
1072 |
return list(tables(db, table.schema, table.name, exact=True)) != []
|
|
1072 |
return list(tables(db, table.schema, table.name, True, cacheable)) != []
|
|
1073 | 1073 |
|
1074 | 1074 |
def table_row_count(db, table, recover=None): |
1075 | 1075 |
return value(run_query(db, mk_select(db, table, [sql_gen.row_count], |
Also available in: Unified diff
sql.py: table_exists(): Allow caller to set whether query will be cached. This is useful if the table will later be created and its existence should be checked again.