{"id":26107117,"url":"https://github.com/opengovern/og_query_runner","last_synced_at":"2026-06-08T14:32:41.502Z","repository":{"id":281317217,"uuid":"944910238","full_name":"opengovern/og_query_runner","owner":"opengovern","description":"Python package for running a given query on a opensecurity instance","archived":false,"fork":false,"pushed_at":"2025-03-08T10:22:28.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-08T10:26:53.600Z","etag":null,"topics":["pip","python3"],"latest_commit_sha":null,"homepage":"https://www.opensecurity.sh","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/opengovern.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":"2025-03-08T08:02:17.000Z","updated_at":"2025-03-08T10:22:33.000Z","dependencies_parsed_at":"2025-03-08T10:26:56.295Z","dependency_job_id":null,"html_url":"https://github.com/opengovern/og_query_runner","commit_stats":null,"previous_names":["opengovern/slay-package","opengovern/og_query_runner"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/opengovern/og_query_runner","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opengovern%2Fog_query_runner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opengovern%2Fog_query_runner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opengovern%2Fog_query_runner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opengovern%2Fog_query_runner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/opengovern","download_url":"https://codeload.github.com/opengovern/og_query_runner/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opengovern%2Fog_query_runner/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34067348,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-08T02:00:07.615Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["pip","python3"],"created_at":"2025-03-09T22:43:21.366Z","updated_at":"2026-06-08T14:32:41.478Z","avatar_url":"https://github.com/opengovern.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Opengovernance Query Runner Package\n\n- [Opengovernance Query Runner Package](#opengovernance-query-runner-package)\n  - [Installation](#installation)\n    - [Clone the repository](#clone-the-repository)\n    - [Install the package](#install-the-package)\n  - [Functions](#functions)\n  - [RunQuery](#runquery)\n    - [Parameters](#parameters)\n    - [Returns](#returns)\n    - [Example](#example)\n    - [Output](#output)\n  - [SaveQueryResults](#savequeryresults)\n    - [Parameters](#parameters-1)\n    - [Returns](#returns-1)\n    - [Example](#example-1)\n  - [RunAndSaveQuery](#runandsavequery)\n    - [Parameters](#parameters-2)\n    - [Returns](#returns-2)\n    - [Example](#example-2)\n  - [ReadQueryFromFile](#readqueryfromfile)\n    - [Parameters](#parameters-3)\n    - [Returns](#returns-3)\n    - [Example](#example-3)\n  - [Example File](#example-file)\n  - [License](#license)\n\n## Installation\n\n### Clone the repository\n\n```bash\ngit clone https://github.com/opengovern/og_query_runner.git\n```\n\n### Install the package\n\n```bash\npip install .\n```\n\n## Functions\n\n- RunQuery\n- SaveQueryResults\n- RunAndSaveQuery\n- ReadQueryFromFile\n\n## RunQuery\n\nExecutes a query on a given instance URL using an API key.\n\n### Parameters\n\n- `instance_url`: string\n  - The base URL of the instance where the query will be executed.\n- `query`: string\n  - The query string to be executed.\n- `api_key`: string\n  - The API key for authentication.\n\n### Returns\n\n- `dict`\n  - The results of the query as a JSON object.\n\n### Example\n\n```python\nfrom og_query_runner import RunQuery\n\nresponse = RunQuery(\"https://instance_url\", \"SELECT * FROM table\", \"api_key\")\nprint(response)\n```\n\n### Output\n\n```json\n{\n    \"headers\": [\"column1\", \"column2\"],\n    \"result\": [[\"x\", \"y\"], [\"a\", \"b\"]]\n}\n```\n\n## SaveQueryResults\n\nSaves query results to a CSV file and optionally saves the query itself.\n\n### Parameters\n\n- `data`: dict\n  - The results of the query, including headers and result rows.\n- `file_path`: string\n  - The filename (without `.csv`) where the results will be saved.\n- `query`: string (optional)\n  - The query string to be saved.\n\n### Returns\n\n- None\n\n### Example\n\n```python\nfrom og_query_runner import SaveQueryResults\n\nSaveQueryResults({\n    \"headers\": [\"column1\", \"column2\"],\n    \"result\": [[\"x\", \"y\"], [\"a\", \"b\"]]\n}, \"results\")\n```\n\n## RunAndSaveQuery\n\nExecutes a query and saves the results to a CSV file.\n\n### Parameters\n\n- `instance_url`: string\n  - The base URL of the instance where the query will be executed.\n- `query`: string\n  - The query string to be executed.\n- `api_key`: string\n  - The API key for authentication.\n- `file_path`: string\n  - The filename (without `.csv`) where the results will be saved.\n\n### Returns\n\n- None\n\n### Example\n\n```python\nfrom og_query_runner import RunAndSaveQuery\n\nRunAndSaveQuery(\"https://instance_url\", \"SELECT * FROM table\", \"api_key\", \"results\")\n```\n\n## ReadQueryFromFile\n\nReads a query result from a CSV file and reconstructs it in the same format as `RunQuery`.\n\n### Parameters\n\n- `file_path`: string\n  - The path to the CSV file (without `.csv`) containing the query result.\n\n### Returns\n\n- `dict`\n  - A dictionary with 'headers' (list of column names) and 'result' (list of row values).\n\n### Example\n\n```python\nfrom og_query_runner import ReadQueryFromFile\n\nresult = ReadQueryFromFile(\"results\")\nprint(result)\n```\n\n## Example File\n\nyou can find an example file in the repository named [example.py](example.py) that demonstrates how to use the package.\n\n## License\n\n see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopengovern%2Fog_query_runner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopengovern%2Fog_query_runner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopengovern%2Fog_query_runner/lists"}