table2bucket.py 1.6 KB

12345678910111213141516171819202122232425262728293031323334
  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. print(f'Exported {args.project}.{args.bucket} to {args.table}')
  8. if __name__ == "__main__":
  9. import argparse
  10. parser = argparse.ArgumentParser()
  11. parser.add_argument('--project', type=str, default='bigquery-public-data.crypto_ethereum',
  12. choices=['lexical-theory-329617.crypto_ethereum',
  13. 'bigquery-public-data.crypto_ethereum'])
  14. parser.add_argument('--bucket', type=str, default='blocks',
  15. choices=['blocks', 'transactions', 'transactions2', 'transactions3',
  16. 'tokens', 'token_transfers', 'traces', 'contracts', 'transactions_1week',
  17. 'transactions_1month', 'transactions_1year'])
  18. parser.add_argument('--table', type=str, default='ethereum-block-data',
  19. choices=['ethereum-block-data', 'ethereum-transaction-data',
  20. 'ethereum-transaction-data2', 'ethereum-transaction-data3',
  21. 'ethereum-token-data', 'ethereum-transfers-data',
  22. 'ethereum-trace-data', 'ethereum-contract-data',
  23. 'ethereum-transaction-1week-data',
  24. 'ethereum-transaction-1month-data',
  25. 'ethereum-transaction-1year-data'])
  26. args: Any = parser.parse_args()
  27. main(args)