-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0975df3
commit 51b9a8d
Showing
4 changed files
with
384 additions
and
223 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
with source as ( | ||
select * from {{ source('public', 'raw_projects') }} | ||
), | ||
|
||
renamed as ( | ||
select | ||
{{ adapter.quote("id") }} as project_id, | ||
{{ adapter.quote("projectNumber") }} as project_number, | ||
{{ adapter.quote("metaPtr") }} as meta_ptr, | ||
{{ adapter.quote("metadata") }} as metadata, | ||
{{ adapter.quote("owners") }} as owners, | ||
{{ adapter.quote("createdAtBlock") }} as created_at_block, | ||
{{ adapter.quote("chainId") }} as chain_id | ||
from source | ||
), | ||
|
||
extracted_metadata as ( | ||
select | ||
*, | ||
json_extract_path_text(metadata, 'title') as title, | ||
json_extract_path_text(metadata, 'description') as description, | ||
json_extract_path_text(metadata, 'website') as website, | ||
json_extract_path_text(metadata, 'projectTwitter') as project_twitter, | ||
json_extract_path_text(metadata, 'logoImg') as logo_image, | ||
json_extract_path_text(metadata, 'bannerImg') as banner_image, | ||
json_extract_path_text(metadata, 'createdAt')::numeric as created_at, | ||
from renamed | ||
) | ||
|
||
select * from extracted_metadata |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "raw", | ||
"metadata": {}, | ||
"source": [ | ||
"---\n", | ||
"title: \"Getting Chain Data\"\n", | ||
"format: html\n", | ||
"---" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 6, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import duckdb\n", | ||
"\n", | ||
"duckdb.sql(\n", | ||
" \"\"\"\n", | ||
" set s3_region = \"auto\";\n", | ||
" set s3_url_style = \"path\";\n", | ||
" set s3_endpoint = 'ed5d915e0259fcddb2ab1ce5592040c3.r2.cloudflarestorage.com';\n", | ||
" set s3_access_key_id = '43c31ff797ec2387177cabab6d18f15a';\n", | ||
" set s3_secret_access_key = 'afb354f05026f2512557922974e9dd2fdb21e5c2f5cbf929b35f0645fb284cf7';\n", | ||
"\n", | ||
" create table ethereum_raw_blocks as (\n", | ||
" select\n", | ||
" *\n", | ||
" from read_parquet(\"s3://indexed-xyz/ethereum/raw/blocks/v1.2.0/partition_key=9d/dt=2023/*.parquet\")\n", | ||
" );\n", | ||
"\"\"\"\n", | ||
")" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.11.6" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
Oops, something went wrong.