mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
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
7 lines
338 B
HTML
7 lines
338 B
HTML
<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>
|