Created
October 26, 2022 08:46
-
-
Save patrikbraborec/88d9f295227543fcc35debeac1ea9500 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| with stock as ( | |
| select id, symbol, date, to_json(data) as data_json from input_stage.stock | |
| ), | |
| final as ( | |
| select | |
| id, | |
| symbol, | |
| date, | |
| CAST(json_extract_path_text(data_json, '1. open') as float) as open, | |
| CAST(json_extract_path_text(data_json, '2. high') as float) as high, | |
| CAST(json_extract_path_text(data_json, '3. low') as float) as low, | |
| CAST(json_extract_path_text(data_json, '4. close') as float) as close, | |
| CAST(json_extract_path_text(data_json, '5. volume') as float) as volume | |
| from stock | |
| ) | |
| select * from final |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment