This pipeline pulls data from a single subgraph_entity source, processes the data with a single SQL transformation, and stores the result into a PostgreSQL sink.

You will need to have the existing subgraph with the name/version combo of polymarket/1.0.0 as a prerequisite to running this pipeline.

sync-subgraphs-postgres-pipeline.yaml
name: syncing-a-subgraph-into-postgres
apiVersion: 3
sources:
  polygon.fixed_product_market_maker:
    type: subgraph_entity
    name: fixed_product_market_maker
    subgraphs:
    - name: polymarket
      version: 1.0.0
transforms:
  negative_fpmm_scaled_liquidity_parameter:
    sql: SELECT id FROM polygon.fixed_product_market_maker WHERE scaled_liquidity_parameter < 0
    primary_key: id
sinks:
  postgres_polygon_sink:
    type: postgres
    from: negative_fpmm_scaled_liquidity_parameter
    table: test_negative_fpmm_scaled_liquidity_parameter
    schema: public
    secret_name: API_POSTGRES_CREDENTIALS

You can start above pipeline by running:

goldsky pipeline start pipeline.yaml

Or

goldsky pipeline apply pipeline.yaml --status ACTIVE