Act

petr_cermak/MySQL-insert

  • Builds
  • latest 0.0.15 / 2017-10-24
  • Created 2017-07-11
  • Last modified 2017-11-21
  • grade 2

Description

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


API

To run the act, send a HTTP POST request to:

https://api.apify.com/v2/acts/petr_cermak~MySQL-insert/runs?token=<YOUR_API_TOKEN>

The POST payload will be passed as input for the act. For more information, read the docs.


Example input

Content type: application/json

{
    "_id": "YOUR_EXECUTION_ID",
    "data": {
        "connection": {
           "host"            : "DB_HOSTNAME",
           "user"            : "DB_USERNAME",
           "password"        : "DB_PASSFORD",
           "database"        : "DB_DATABASE"
        },
        "table": "DB_TABLE_NAME"
    }
}

Readme

act-mysql-insert

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

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

The act does not store its state, i.e. if it crashes it restarts fetching all URLs. Therefore you should only use it for short lists of URLs.

INPUT

Input is a JSON object with the following properties:

{
    // crawler executionID
    "_id": "your_execution_id",

    // MySQL connection credentials
    "data": {
        "connection": {
          "host"      : "host_name",
          "user"      : "user_name",
          "password"  : "user_password",
          "database"  : "database_name"
        },
        "table": "table_name"
    }
}

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.