SQL execution
Hi
It would be lovely to have SQL execution in presenterm.
Right now (with PostgreSQL in my case), I do it by adding this to the
`executors.yaml` file:
```yaml
sql:
filename: snippet.sql
commands:
- ["psql", "-f", "$pwd/snippet.sql", "-d", "host=/var/run/postgresql port=5433 user=benoit dbname=benoit"]
```
It works but it's a little bothersome to modify it for each new test/demo
cluster and it's not possible to use different connection parameters in the
same md file.
I think using `psql` for query execution is good (instead of using a library to
do it) because it's simpler (execution and display is already handled) and we
can leverage all psql's metacommand which is invaluable for presentations.
Other databases could use the alternate commands facility that use their own
CLI.
Would you be open to add some form of generic `parameter` attribute to the
`SnippetAttributes`? It could be used to add a connection string to the snippet
and feed it to psql. From what I understand, it's not possible yet.
Note:
* for psql access to the environnment variables
`PG{USER|DATABASE|HOST|PORT}` when executing `psql` would be ok too but less
versatile.
* I can try to make a PR if there is a consensus on what is acceptable.
1 条评论