Upsert to PostgreSQL
Version updated for yakubique/upsert-postgresql to version v1.
- This action is used across all versions by ? repositories.
Go to the GitHub Marketplace to find the latest changes.
Release notes
Upsert to PostgreSQL
Upsert anything to PostgreSQL Full Changelog: https://github.com/yakubique/upsert-postgresql/commits/v1
Insert or update provided JSON array (or file with JSON array) to database. Conflicts would be resolved
by column_to_match
Usage
- name: Upsert
id: upsert
uses: yakubique/upsert-postgresql@v1
with:
input: |
[{ "id": 1, "value": "c", "test": 1 }, { "id": 2, "value": "b", "test": 2 }]
host: ${{ env.PG_HOST }}
port: ${{ env.PG_PORT }}
username: ${{ env.PG_USER }}
password: ${{ env.PG_PWD }}
db: ${{ env.PG_DB }}
ssl: 'false'
column_to_match: 'id'
table_name: 'test'
Inputs
INPUT | TYPE | REQUIRED | DEFAULT | DESCRIPTION |
---|---|---|---|---|
input | string | true | Input JSON/file | |
db | string | true | PostgreSQL db | |
host | string | true | PostgreSQL host | |
username | string | true | PostgreSQL username | |
password | string | true | PostgreSQL password | |
table_name | string | true | Name of table to upsert | |
column_to_match | string | true | Primary column to match records | |
port | string | true | "5432" | PostgreSQL port (default: 5432) |
ssl | string | false | "true" | SSL enabled (default: ’true') |
from_file | string | false | "false" | Read query from file (default: ‘false’) |
table_schema | string | false | "public" | Table schema to upsert (default: ‘public’) |
to_file | string | false | "false" | Save result to file (default: ‘false’) |
Outputs
OUTPUT | TYPE | DESCRIPTION |
---|---|---|
count | string | Upserted rows count |