SEC Form 4 PostgreSQL Inserter icon

SEC Form 4 PostgreSQL Inserter

Inserts or updates parsed SEC Form 4 filing data into PostgreSQL tables

SEC Form 4 PostgreSQL Inserter

AI-generated

Summary

Upserts parsed SEC Form 4 filing JSON from each input item into a set of prefixed PostgreSQL tables, optionally creating the tables first, and returns per-filing row counts.

Inputs

  • Table Prefix — Prefix prepended to all table names (default "sec_"). Tables used: issuers, reporting_owners, filings, filing_owners, non_derivative_transactions, derivative_transactions, non_derivative_holdings, derivative_holdings, footnotes, signatures.
  • Create Tables If Missing — If true (default), runs CREATE TABLE IF NOT EXISTS for all ten tables once before processing items. Turn off if the schema is already managed elsewhere.
  • Postgres credential (required) — Standard n8n 'postgres' credential (host, port, database, user, password, ssl). If ssl is 'require', SSL is used with rejectUnauthorized disabled.
  • Input items (required) — Each item's JSON must be a parsed Form 4 object (e.g. from the companion SEC Form 4 parser) with filing, issuers, reportingOwners, nonDerivativeTransactions, derivativeTransactions, nonDerivativeHoldings, derivativeHoldings, footnotes and signatures.

Output shape

One output item per input item, with JSON containing accessionNumber and counts: issuersUpserted, ownersUpserted, filingOwnersUpserted, nonDerivativeTransactions, derivativeTransactions, nonDerivativeHoldings, derivativeHoldings, footnotes, signatures.

Each filing is written in its own transaction (BEGIN/COMMIT, ROLLBACK on error), so a failed filing leaves no partial rows. Rows are upserted via ON CONFLICT on primary keys (e.g. accession_number, or accession_number + id), so re-running updates existing data. With 'Continue On Fail', failed items return {error: message}; otherwise the node throws a NodeOperationError for that item. Output items are paired to inputs. The prefix is interpolated into quoted identifiers, so use a trusted value.

Examples

Example 1: Store parsed Form 4 filings in a Postgres database for insider-trading analysis

Connect the Form 4 parser node's output to this node, select a Postgres credential, keep Table Prefix 'sec_' and Create Tables If Missing enabled.

Example 2: Write into a pre-existing, separately managed schema under a custom namespace

Set Table Prefix to 'insider_' and disable Create Tables If Missing, ensuring the insider_* tables already exist with matching columns.

Links

Discussion