PostgreSQL Insert avatar
PostgreSQL Insert
Try for free

No credit card required

View all Actors
PostgreSQL Insert

PostgreSQL Insert

petr_cermak/postgresql-insert
Try for free

No credit card required

This act takes a crawler execution and inserts it's results into a remote PostgreSQL database.

act-postgresql-insert

Apify act for inserting crawler results into a remote PostgreSQL table.

This act fetches all results from a specified Apifier crawler execution and inserts them into a table in a remote PostgreSQL database.

The act does not store its state, i.e. if it crashes it restarts fetching all the results. Therefore you should only use it for executions with low number of results.

INPUT

Input is a JSON object with the following properties:

1{
2    // crawler executionID
3    "_id": "your_execution_id",
4
5    // PostgreSQL connection credentials
6    "data": {
7        "connection": {
8          "host"      : "host_name",
9          "port"      : "port_number",
10          "user"      : "user_name",
11          "password"  : "user_password",
12          "database"  : "database_name"
13        },
14        "table": "table_name"
15    }
16}

The act can be run with a crawler finish webhook, in such case fill just the contents of data attribute into a crawler finish webhook data.

Additionally to crawler results, it is also possible to specify a dataset id, to fetch the result from a dataset.

1{
2    // id of dataset to fetch rows from
3    "datasetId": "dataset_id",
4
5    // PostgreSQL connection credentials
6    "data": "connection_credentials"
7}

Alternatively you can directly specify the rows to be inserted (i.e. not fetching them from crawler execution).

1{
2    // rows to be inserted
3    "rows": [
4        {"column_1": "value_1", "column_2": "value_2"},
5        {"column_1": "value_3", "column_2": "value_4"},
6        ...
7    ],
8
9    // PostgreSQL connection credentials
10    "data": "connection_credentials"
11}
Developer
Maintained by Community
Actor metrics
  • 1 monthly user
  • 0 stars
  • Created in Nov 2017
  • Modified about 3 years ago
Categories