table2bucket.py 1.6 KB

123456789101112131415161718192021222324252627282930313233
  1. from typing import Any
  2. from src.utils.bigquery import EthereumBigQuery
  3. def main(args: Any):
  4. query: EthereumBigQuery = EthereumBigQuery(args.project)
  5. # pprint(query.get_table_names())
  6. query.export_to_bucket(args.bucket, args.table)
  7. if __name__ == "__main__":
  8. import argparse
  9. parser = argparse.ArgumentParser()
  10. parser.add_argument('--project', type=str, default='bigquery-public-data.crypto_ethereum',
  11. choices=['lexical-theory-329617.crypto_ethereum',
  12. 'bigquery-public-data.crypto_ethereum'])
  13. parser.add_argument('--bucket', type=str, default='blocks',
  14. choices=['blocks', 'transactions', 'transactions2', 'transactions3',
  15. 'tokens', 'token_transfers', 'traces', 'contracts', 'transactions_1week',
  16. 'transactions_1month', 'transactions_1year'])
  17. parser.add_argument('--table', type=str, default='ethereum-block-data',
  18. choices=['ethereum-block-data', 'ethereum-transaction-data',
  19. 'ethereum-transaction-data2', 'ethereum-transaction-data3',
  20. 'ethereum-token-data', 'ethereum-transfers-data',
  21. 'ethereum-trace-data', 'ethereum-contract-data',
  22. 'ethereum-transaction-1week-data',
  23. 'ethereum-transaction-1month-data',
  24. 'ethereum-transaction-1year-data'])
  25. args: Any = parser.parse_args()
  26. main(args)