{"id":15187530,"url":"https://github.com/jreyesr/steampipe-plugin-postgres","last_synced_at":"2025-10-27T06:31:48.484Z","repository":{"id":193173100,"uuid":"688276897","full_name":"jreyesr/steampipe-plugin-postgres","owner":"jreyesr","description":"A Steampipe plugin that provides access to data stored in plain Postgres servers","archived":false,"fork":false,"pushed_at":"2024-01-07T01:57:06.000Z","size":526,"stargazers_count":6,"open_issues_count":2,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-01T03:14:40.173Z","etag":null,"topics":["postgresql","postgresql-fdw","sql","steampipe-plugin"],"latest_commit_sha":null,"homepage":"","language":"Go","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/jreyesr.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-09-07T02:43:54.000Z","updated_at":"2024-06-12T14:53:53.000Z","dependencies_parsed_at":"2023-09-07T04:24:42.156Z","dependency_job_id":"1e96fa0e-6ee5-4300-b4d6-f2ba1de75c25","html_url":"https://github.com/jreyesr/steampipe-plugin-postgres","commit_stats":null,"previous_names":["jreyesr/steampipe-plugin-postgres"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jreyesr%2Fsteampipe-plugin-postgres","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jreyesr%2Fsteampipe-plugin-postgres/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jreyesr%2Fsteampipe-plugin-postgres/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jreyesr%2Fsteampipe-plugin-postgres/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jreyesr","download_url":"https://codeload.github.com/jreyesr/steampipe-plugin-postgres/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238455058,"owners_count":19475369,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["postgresql","postgresql-fdw","sql","steampipe-plugin"],"created_at":"2024-09-27T18:23:47.809Z","updated_at":"2025-10-27T06:31:48.131Z","avatar_url":"https://github.com/jreyesr.png","language":"Go","readme":"# Postgres Plugin for Steampipe\n\nUse SQL to query data from plain PostgreSQL databases.\n\nThis repo contains a [Steampipe](https://steampipe.io/) plugin that exposes plain PostgreSQL databases as Steampipe tables, much like [the CSV plugin](https://hub.steampipe.io/plugins/turbot/csv) does for CSV files, or like a reverse proxy does for HTTP. This can be used to join API data with semi-static data that is hosted on databases.\n\nSee below for an example that mixes data from a static DB (contact information for the teams that own Kubernetes namespaces) and data from Kubernetes (which namespaces have Failed pods). This may be part of an automated alerting system that runs periodically and sends emails.\n\n![Alt text](docs/image.png)\n\nSteampipe currently has no such functionality, with an alternative being exporting a copy of the Postgres DB as a CSV and then using the [CSV plugin](https://hub.steampipe.io/plugins/turbot/csv). However, the CSV file may be out of date, and you're responsible for keeping it updated. This plugin, instead, will always have up-to-date results, since it queries the backing Postgres DB whenever a query comes in to Steampipe. Another alternative is to manually install and configure [the `postgres-fdw` module on Steampipe](https://www.postgresql.org/docs/current/postgres-fdw.html), which requires connecting to the DB as root, is not documented and doesn't play too well with Dockerized deployments.\n\n- **[Get started →](https://hub.steampipe.io/plugins/jreyesr/postgres)**\n- Documentation: [Table definitions \u0026 examples](https://hub.steampipe.io/plugins/jreyesr/postgres/tables)\n- Community: [Join #steampipe on Slack →](https://turbot.com/community/join)\n- Get involved: [Issues](https://github.com/jreyesr/steampipe-plugin-postgres/issues)\n\n## Quick start\n\nDownload and install the latest Postgres plugin:\n\n```shell\nsteampipe plugin install jreyesr/postgres\n```\n\nInstalling the latest Postgres plugin will create a config file (`~/.steampipe/config/postgres.spc`) with a single connection named `postgres`:\n\n```hcl\nconnection \"postgres\" {\n  plugin = \"jreyesr/postgres\"\n\n  # A connection string (https://pkg.go.dev/github.com/jackc/pgx/v5#hdr-Establishing_a_Connection), in the form that is \n  # expected by the pgx package. Required. \n  # Can also be set with the `DATABASE_URL` environment variable.\n  # connection_string = \"postgres://username:password@localhost:5432/database_name\"\n\n  # The remote DB's schema that this plugin will expose. If you leave this unset, it'll default to `public`.\n  # schema = \"public\"\n\n  # List of tables that will be exposed from the remote DB. No dynamic tables will be created if this arg is empty or not set.\n  # Wildcard based searches are supported.\n  # For example:\n  #  - \"*\" will expose every table in the remote DB\n  #  - \"auth-*\" will expose tables whose names start with \"auth-\"\n  #  - \"users\" will only expose the specific table \"users\"\n  # You can have several items (for example, [\"auth-*\", \"users\"] will expose \n  # all the tables that start with \"auth-\", PLUS the table \"users\")\n  # Defaults to all tables\n  # tables_to_expose = [\"*\"]\n}\n```\n\nAlternatively, you can also use the following environment variable to obtain credentials **only if the other argument (`connection_string`)** is not specified in the connection:\n\n```bash\nexport DATABASE_URL=postgres://username:password@localhost:5432/database_name\n```\n\nRun Steampipe:\n\n```shell\nsteampipe query\n```\n\nRun a query for whatever table the Postgres DB has:\n\n```sql\nselect\n  attr1,\n  attr2\nfrom\n  postgres.some_table;\n```\n\nThis plugin forwards all conditions that are supported by Steampipe to the remote DB. For example, a `WHERE col=1` condition _will_ be forwarded, so the remote DB can optimize its searches. More complex operators (such as JSONB operations) can't be forwarded and will thus result in a full table scan on the remote DB. In this case, the filtering will be applied by Steampipe.\n\n## Developing\n\nPrerequisites:\n\n- [Steampipe](https://steampipe.io/downloads)\n- [Golang](https://golang.org/doc/install)\n\nClone:\n\n```sh\ngit clone https://github.com/jreyesr/steampipe-plugin-postgres.git\ncd steampipe-plugin-postgres\n```\n\nBuild, which automatically installs the new version to your `~/.steampipe/plugins` directory:\n\n```\nmake\n```\n\nConfigure the plugin:\n\n```\ncp config/* ~/.steampipe/config\nvi ~/.steampipe/config/postgres.spc\n```\n\nTry it!\n\n```\nsteampipe query\n\u003e .inspect postgres\n```\n\nFurther reading:\n\n- [Writing plugins](https://steampipe.io/docs/develop/writing-plugins)\n- [Writing your first table](https://steampipe.io/docs/develop/writing-your-first-table)\n\n## Contributing\n\nPlease see the [contribution guidelines](https://github.com/turbot/steampipe/blob/main/CONTRIBUTING.md) and our [code of conduct](https://github.com/turbot/steampipe/blob/main/CODE_OF_CONDUCT.md). All contributions are subject to the [Apache 2.0 open source license](https://github.com/jreyesr/steampipe-plugin-postgres/blob/master/LICENSE.md).\n\n`help wanted` issues:\n\n- [Steampipe](https://github.com/turbot/steampipe/labels/help%20wanted)\n- [Postgres Plugin](https://github.com/jreyesr/steampipe-plugin-postgres/labels/help%20wanted)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjreyesr%2Fsteampipe-plugin-postgres","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjreyesr%2Fsteampipe-plugin-postgres","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjreyesr%2Fsteampipe-plugin-postgres/lists"}