SQLite query restrictions

后端 未结 3 1188
太阳男子
太阳男子 2021-01-22 15:06

I am building a little interface where I would like users to be able to write out their entire sql statement and then see the data that is returned. However, I

3条回答
  •  面向向阳花
    2021-01-22 15:59

    I can suggest a different approach to your problem. You can restrict the access to your database as read-only. That way even when the users try to execute delete/update queries they will not be able to damage your data.

    Here is the answer for Python on how to open a read-only connection:

    db = sqlite3.connect('file:/path/to/database?mode=ro', uri=True)
    

提交回复
热议问题