Revision 2548
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
832 | 832 |
run_query(db, 'ALTER TABLE '+table+' ADD COLUMN '+row_num_col |
833 | 833 |
+' serial NOT NULL PRIMARY KEY', log_level=3) |
834 | 834 |
|
835 |
def tables(db, schema='public', table_like='%'): |
|
835 |
def tables(db, schema_like='public', table_like='%'):
|
|
836 | 836 |
module = util.root_module(db.db) |
837 |
params = {'schema': schema, 'table_like': table_like}
|
|
837 |
params = {'schema_like': schema_like, 'table_like': table_like}
|
|
838 | 838 |
if module == 'psycopg2': |
839 | 839 |
return values(run_query(db, '''\ |
840 | 840 |
SELECT tablename |
841 | 841 |
FROM pg_tables |
842 | 842 |
WHERE |
843 |
schemaname = %(schema)s
|
|
843 |
schemaname LIKE %(schema_like)s
|
|
844 | 844 |
AND tablename LIKE %(table_like)s |
845 | 845 |
ORDER BY tablename |
846 | 846 |
''', |
Also available in: Unified diff
sql.py: tables(): Changed schema param to schema_like and filter the schema using LIKE so that all schemas can be selected