sql - Is it possible to use a returned column value as a table name in an SQLite query? -


i want write query examines tables in sqlite database piece of information in order simplify post-incident diagnostics (performance doesn't matter).

i hoping write query uses the sqlite_master table list of tables , query them, in 1 query:

select name  sqlite_master type = 'table' , (     select count(*)     name     conditions     ) > 0; 

however when attempting execute style of query, receive error no such table: name. there alternate syntax allows this, or not supported?

sqlite designed embedded database, i.e., used 'real' programming language. able use such dynamic constructs, must go outside of sqlite itself:

cursor.execute("select name sqlite_master") rows = cursor.fetchall() row in rows:     sql = "select ... {} ...".format(row[0])     cursor.execute(sql) 

Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -