n8n

How to Automate MySQL and PostgreSQL Label Printing?

Speed up warehouse label work by pulling roll data and product grade details into one clean payload. A simple POST request starts the flow and returns ready to print data. Operations and inventory teams can issue labels faster with fewer errors.

The flow begins with a webhook that receives the request. It then fetches print settings from a config service, collects roll details from PostgreSQL, and loads product grade data from MySQL. A function prepares the input, and a merge step ties both datasets together using the movement detail id. The response returns only after the merge completes, so your label app gets one consistent dataset.

Setup needs access to both databases and a reachable config endpoint. Expect faster label runs, lower error rates, and less copy paste. Great for cutting rooms, receiving, and production lines where rolls are tracked and labeled often.

What are the key features?

  • Webhook receives a POST request to start label creation.
  • HTTP request loads print configuration from a config service.
  • MySQL query fetches product grade details tied to the requested item.
  • PostgreSQL query returns roll records by a list of roll ids.
  • Function step prepares the input and shapes values for the queries.
  • Merge by key joins roll and product data on the movement detail id.
  • Webhook responds with the merged data so printers or apps can use it right away.

What are the benefits?

  • Reduce label prep from 30 minutes to 3 minutes
  • Eliminate up to 90 percent of data entry errors
  • Unify three data sources into one response for printing
  • Automate 80 percent of repetitive label tasks
  • Handle five times more label requests during peak hours

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. You'll need accounts with MySQL, PostgreSQL and Parse Server. See the Tools Required section above for links to create accounts with these services.
  3. In the n8n credentials manager, create a MySQL credential. Enter host, port, database name, user, and password. Save it and select it in the MySQL node that loads product grade data.
  4. In the n8n credentials manager, create a PostgreSQL credential. Enter host, port, database name, user, and password. Save it and select it in the PostgreSQL node that loads roll data.
  5. Open the HTTP Request node for print config. Set the base URL of your config service. Add a header named X Parse Application Id with your app id. Add any other headers your service needs for auth.
  6. Open the Webhook node and confirm the method is POST and the path matches your route. Copy the test URL for the next step.
  7. Send a sample POST with a tool like Postman or curl. Include a body with id_produto_grade and an array named idRolos. Confirm you receive a JSON response with both product and roll fields.
  8. Review the SQL in the MySQL and PostgreSQL nodes. Map table names and field names to match your schema. Test each query in your database client if needed.
  9. Verify the merge step uses the movement detail id present in both datasets. If your key differs, change the merge fields to a key that exists in both queries.
  10. Click Execute Node on the HTTP Request, database, and merge steps to validate each part. Fix any errors before turning on the workflow.
  11. Switch the Webhook node to production URL and update your source system to call that URL. Turn on the workflow in n8n and run a live test.
  12. Troubleshooting: if you get a database connection error, check host and firewall. If no data returns, confirm the roll ids array is not empty. If the merge is empty, make sure the join key exists in both query results.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

MySQL

Sign up

MySQL Community Edition (GPL) – Free ($0)

Parse Server

Sign up

Free, open-source (self-hosted): $0 / mo

PostgreSQL

Sign up

Free: $0 (open-source PostgreSQL License; self-hosted)

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.