cowprotocol / cowprotocol/dune-sync

Dune-Sync v2

Open
#112 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted
Dominant language
Python
Stars
5
Forks
1
PR merge metrics
No merged PRs in 30d

Description

It would be great to have a more generalised version of the dune-sync client that allows for both

  1. Syncing data from Dune to a local DB
  2. Syncing data from a local DB to Dune

Given that Dune has evolved and no longer recommends uploading data into S3 bucket it ingests, I'd suggest for 1) to mainly happen via the upload_csv functionality (as used in https://github.com/cowprotocol/dune-sync/blob/main/src/sync/app_data.py#L21).

I'd also suggest the new version to be completely domain agnostic in that all required information about the source and target data as well as queries can be provided separately (and thus packaged wherever dune-sync is deployed). The fact that for instance at the moment the app_hashes sql is checked into this repo, while the configuration of the sync job happens in the infrastructure repository is a smell imo.

I would suggest something like this as the general configuration shema:

[[datasources]]
name = "postgres"
type = "postgres"
url = "postgresql://host:port/?user=&password="

[[datasources]]
name = "dune"
type = "dune"
apikey = "xyz"

[[jobs]]
from = "dune" # referencing datasource name
to = "postgres" # referencing datasource name
query = 40000123 # referencing dune query id
target = "table" # referencing postgres target table
truncate = false # if table should be truncated before

[[jobs.parameters]]
day = "2021-01-01"
blockchain = "ethereum"

[[jobs]]
from = "postgres"
to = "dune"
query = "SELECT * FROM PRICES" # SQL query string
target = "table_name" # Dune table name
private = false # whether the dune table should be private or not

This way this client becomes a general purpose middleware for any web3 team that wants to bridge data in and out of Dune.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/sync/app_data.py and its existing upload_csv usage, then compare that flow with the proposed TOML datasources and jobs schema. Done means supporting configurable, domain-agnostic transfers in both directions between Dune and a local database, including the listed query, target, parameter, truncation, and privacy settings.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, python, sql
Domain
backend, database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.