Upsert to PostgreSQL
Version updated for yakubique/upsert-postgresql to version v1.1.
- 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/compare/v1...v1.1
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.1
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 | |
password | string | true | PostgreSQL password | |
username | string | true | PostgreSQL username | |
port | string | true | "5432" | PostgreSQL port (default: 5432) |
table_name | string | true | Name of table to upsert | |
column_to_match | string | true | Primary column to match records (possible to pass multiple columns, comma separated) | |
table_schema | string | false | "public" | Table schema to upsert (default: ‘public’) |
ssl | string | false | "true" | SSL enabled (default: ’true') |
to_file | string | false | "false" | Save result to file (default: ‘false’) |
from_file | string | false | "false" | Read query from file (default: ‘false’) |
Outputs
OUTPUT | TYPE | DESCRIPTION |
---|---|---|
count | string | Upserted rows count |