mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Allow ?sql= argument against database
e.g. /database-234324?sql=select * from table limit 1
This commit is contained in:
parent
255e2611e5
commit
0fa1772697
1 changed files with 2 additions and 1 deletions
3
app.py
3
app.py
|
|
@ -137,7 +137,8 @@ class DatabaseView(BaseView):
|
|||
|
||||
def data(self, request, name, hash):
|
||||
conn = get_conn(name)
|
||||
rows = conn.execute('select * from sqlite_master')
|
||||
sql = request.args.get('sql') or 'select * from sqlite_master'
|
||||
rows = conn.execute(sql)
|
||||
columns = [r[0] for r in rows.description]
|
||||
return {
|
||||
'database': name,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue