dfuse-eosio
dfuse-eosio copied to clipboard
SQL Sync proposal
First draft proposal, please comment on.
Here's what a SQL Sync config could look like:
sqlsync:
tables_prefix: "eosio_chain1_" # Global prefix, for all tables
whitelist_contracts:
"*":
tables: "*"
# - or -
eosio.token:
tables: ["table1", "table2", "table3"]
blacklist_contracts:
- skipcontract
- skipcontract2
- skipcontract3
mappings:
- label: "All currency contracts"
# Select which contracts, tables, these mappings apply to
contracts: "*"
scopes: "*"
tables: ["accounts"]
# If set to true, use:
# [prefix]_[contract]_[table]_[scope]
# instead of:
# [prefix]_[contract]_[tableName]
scoped_table_name: false # Mutually opposed to `scope_as_field`.
scope_as_field: true # Creates a compound primary key (_key, _scope)
# If true, include the contract name in the SQL table name
# Otherwise, strips `[contract]_` from SQL tables names.
full_table_name: true
# Some mapping definitions
sql_type_by_field:
amount: "character varying(26)"
memo: "varchar(255) | STRING(?)"
sql_type_by_type: # For other fields
string: "varchar(64)"
- label: "Positions"
contracts: ["nav_past", "nav_going"]
scopes: "*"
tables: ["positions"]
# Some ways of combining some fields into one when in SQL, etc..
sql_type_by_field:
lat: "character varying(26) | POINT({lat}, {lon})"
lon: "SKIP"
sql_type_by_type: # For other fields
string: "varchar(64)"