Allow ?sql= argument against database

e.g. /database-234324?sql=select * from table limit 1
pull/383/head
Simon Willison 2017-10-23 19:48:56 -07:00
rodzic 255e2611e5
commit 0fa1772697
1 zmienionych plików z 2 dodań i 1 usunięć

3
app.py
Wyświetl plik

@ -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,