Overview

You can query any Postgres table from Luabase and merge / include the data in any other Luabase query.

Steps

  1. Click on “Settings”

  2. Click “Add” under Postgres

    Untitled

  3. Add the connection properties (note: your connection details are encrypted before storage). We suggest creating a “read only” user specifically for Luabase with access to only the data you need in Luabase.

    Untitled

  4. Create a new block

  5. Add a parameter {{my_pg_table}} and select Postgres as the type

    Untitled

  6. Select the integration you just added and the schema.table_name for your table

  7. Run the query! A simple select * from {{my_pg_table}} will return the full table

  8. We suggested querying Postgres with a CTE before joining to Luabase data to keep your code organized

    with pg as (
    	select "address" from {{my_pg_table}}
    )
    
    select t.to_address, t.block_timestamp, t.value
    from ethereum.transactions as t
    where t.to_address in (select "address" from pg)