mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Canned query support + database/query template refactor
Named canned queries can now be defined in metadata.json like this:
{
"databases": {
"timezones": {
"queries": {
"timezone_for_point": "select tzid from timezones ..."
}
}
}
}
These will be shown in a new "Queries" section beneath "Views" on the database page.
As part of this, I refactored the logic for the database index page. It used
to combine the functionality for listing available tables and the
functionality for executing custom SQL queries in a single template and view.
I have split that template out into database.html and query.html and reworked
the view to more clearly separate the custom SQL executing code.
Refs #20
This commit is contained in:
parent
0cfd7ce59d
commit
a743cdeafc
5 changed files with 165 additions and 100 deletions
7
datasette/templates/_codemirror.html
Normal file
7
datasette/templates/_codemirror.html
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<script src="/-/static/codemirror-5.31.0.js"></script>
|
||||
<link rel="stylesheet" href="/-/static/codemirror-5.31.0-min.css" />
|
||||
<script src="/-/static/codemirror-5.31.0-sql.min.js"></script>
|
||||
<style>
|
||||
.CodeMirror { height: auto; min-height: 70px; width: 80%; border: 1px solid #ddd; }
|
||||
.CodeMirror-scroll { max-height: 200px; }
|
||||
</style>
|
||||
Loading…
Add table
Add a link
Reference in a new issue