{"id":16866756,"url":"https://github.com/snth/prql-exec","last_synced_at":"2026-04-09T01:32:15.682Z","repository":{"id":193795666,"uuid":"689506389","full_name":"snth/prql-exec","owner":"snth","description":null,"archived":false,"fork":false,"pushed_at":"2023-10-01T21:41:19.000Z","size":55,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-17T16:41:54.026Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/snth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-10T02:53:44.000Z","updated_at":"2023-09-10T18:41:48.000Z","dependencies_parsed_at":"2023-10-01T23:31:30.040Z","dependency_job_id":null,"html_url":"https://github.com/snth/prql-exec","commit_stats":null,"previous_names":["snth/prql-examples","snth/prql-exec"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/snth/prql-exec","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snth%2Fprql-exec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snth%2Fprql-exec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snth%2Fprql-exec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snth%2Fprql-exec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/snth","download_url":"https://codeload.github.com/snth/prql-exec/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snth%2Fprql-exec/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31581864,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"ssl_error","status_checked_at":"2026-04-08T14:31:17.202Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T14:51:36.749Z","updated_at":"2026-04-09T01:32:15.659Z","avatar_url":"https://github.com/snth.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# prql-exec\n\n`prql-exec` is an experimental shell script to make\nsystem tools that accept SQL input easily accessible\nas PRQL libraries.\n\n## Getting started\n\n### Install prql-exec\n\n```sh\ngit clone https://github.com/snth/prql-exec.git\ncd prql-exec\nln -sf \"$(pwd)/prql-exec\" ~/.local/bin/prql-exec\nexport PRQL_LIB_PATH=\".:$(pwd)\"\n```\n\nSince without an `import` statement, `prql-exec` will just\noutput the SQL produced, I usually just alias it to `prql`\nwith:\n\n```sh\nalias prql=prql-exec\n```\n\n## Example usage\n\nThe libraries included by default are:\n\n- [duckdb](duckdb/README.md)\n- [git (mergestat)](git/README.md)\n- [os (osquery)](os/README.md)\n- [postgres](postgres/README.md)\n- [sqlite](sqlite/README.md)\n\n## Adding libraries\n\nLibraries can be added by creating a \u003clibrary\u003e/ directory\nwith a \u003cLibrary.prql\u003e file in it. This can then be used\nin PRQL queries with the `import \u003clibrary\u003e` statement.\n\nMoreover, if there is a `.env` file in the \u003clibrary\u003e/\ndirectory, it will be \"sourced\" and if there is a\n`PRQL_EXEC_COMMAND` environment variable defined in that\nfile, then that command will be executed via `eval`.\nThe generated SQL will be passed to it via a `\"$sql\"`\nargument. Options that can be overridden by the user\nat runtime should be defined in `PRQL_EXEC_OPTIONS`.\nOptions that should never be overriden can simple\nbe included in the COMMAND.\n\nThe general form of the command definition \nshould be something like:\n\nPlease note that the quotes around `$sql` and the lack\nof quotes around `$PRQL_EXEC_OPTIONS` are important!\n\nFor executables that expect to receive SQL via STDIN,\nthis can usually easily be achieved by using a command\ndefinition as follows:\n\n```sh\nPRQL_EXEC_COMMAND='echo \"$sql\" | \u003cCOMMAND\u003e $PRQL_EXEC_OPTIONS'\n```\n\n## Adding private libraries\n\nThis can be used to set up convenient aliases to internal\ndatabases. For example by creating a file `_prod/.env`\n\n```sh\n# _prod/.env\nPGHOST=postgres\nPGPORT=5432\nPGDATABASE=postgres\nPGUSER=postgres\nPGPASSWORD=postgres\nPRQL_COMPILE_OPTIONS=\"--target=sql.postgres --hide-signature-comment\"\nPRQL_EXEC_COMMAND=psql\n```\n\nyou can easily connect to a Postres database with a command like:\n```sh\nprql-exec \"import _prod\\nfrom information_schema.sql_features\"\n```\n\nIn order to prevent you from accidentally commiting any access\ncredentials stored in such a file to git, all libraries beginning\nwith a leading `_` are ignored in the .gitignore.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnth%2Fprql-exec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnth%2Fprql-exec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnth%2Fprql-exec/lists"}