cowprotocol / cowprotocol/dune-sync
Dune-Sync v2
Nobody has claimed this yet.
- 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
- Syncing data from Dune to a local DB
- 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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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