How to Generate a Database Table from Your Neighborhood Pipeline Output
The Neighborhood streams decoded onchain data directly to your database. Once you’ve tested your transformation, the next step is preparing the right table to receive incoming data.
To get a real example of your pipeline’s output use the Test Transformation API to run a dry-run and view the event format.
Here’s an example output from a tested transformation:
Alternatively, paste your transformation code into an large language model (LLM) like ChatGPT and ask it to generate a table based on this code. The model will make assumptions on the data, so ensure to check the generated table schema.
Step 1: Generate a Table Schema
Paste the example output into an LLM or a tool like jsonschema2ddl
, and ask it to generate a CREATE TABLE
statement for your database of choice (e.g., PostgreSQL, MySQL, SQLite). The primary key has to be a unique combination.
Example prompt:
Step 2: Run the Table Schema in Your Database
Here’s an ideal result if you’re using PostgreSQL:
This schema uses a compound key to ensure idempotency. Since pipelines provide at-least-once delivery, uniqueness matters to prevent duplicate rows and ensure data integrity.
Need Help?
Need help setting this up? Send us your sample output at hello@indexing.co — we’ll help generate or review the schema for you.