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
import json | |
import requests | |
import pandas as pd | |
def get_coinpaprika_data(): | |
# Get data from coinpaprika | |
url = "https://api.coinpaprika.com/v1/coins/" | |
response = requests.get(url) | |
return response.json() |
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
import pandas as pd | |
if __name__ == '__main__': | |
# Reload the CSV file due to code execution state reset | |
file_path = '01HKPMHCEM0TFYD6KNPM66XHTT.csv' | |
df = pd.read_csv(file_path) | |
# Construct the SQL query in the desired format with dynamic field names | |
sql_query = "SELECT " |
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
import pandas as pd | |
import yaml | |
# 读取CSV文件 | |
df = pd.read_csv('dex_base_trades_seed.csv') | |
# 初始化schema字典 | |
schema = { | |
"version": 2, | |
"seeds": [] |
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
import os | |
import re | |
# Get the current working directory | |
directory = os.getcwd() | |
# Iterate over all files in the directory and its subdirectories | |
for dirpath, dirnames, filenames in os.walk(directory): | |
for filename in filenames: | |
# Process only files with a .sql extension |
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
import os | |
import re | |
# 获取当前工作目录 | |
directory = os.getcwd() | |
# 定义日期的正则表达式 | |
date_pattern = r"'((19|20)\d\d[-](0[1-9]|1[012])[-](0[1-9]|[12][0-9]|3[01]))'" | |
# 遍历目录及其所有子目录下的所有文件 |
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
import os | |
import re | |
# 获取当前工作目录 | |
directory = os.getcwd() | |
# 遍历目录及其所有子目录下的所有文件 | |
for dirpath, dirnames, filenames in os.walk(directory): | |
for filename in filenames: | |
# 只处理.sql文件 |
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
import os | |
import re | |
# 获取当前工作目录 | |
directory = os.getcwd() | |
# 遍历目录及其所有子目录下的所有文件 | |
for dirpath, dirnames, filenames in os.walk(directory): | |
for filename in filenames: | |
# 只处理.sql文件 |
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
import json | |
def get_model_dependencies(manifest_file, model_name): | |
with open(manifest_file, 'r') as f: | |
manifest = json.load(f) | |
# Build the adjacency list | |
adj_list = {} | |
for full_model_name, model in manifest['nodes'].items(): | |
if not full_model_name.startswith('model.'): |
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
import json | |
def get_model_dependencies(manifest_file, model_name): | |
with open(manifest_file, 'r') as f: | |
manifest = json.load(f) | |
def get_dependencies(full_model_name, indent=0): | |
if full_model_name.startswith('model.'): | |
model = manifest['nodes'].get(full_model_name) | |
if model is None: |
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
import os | |
import re | |
import shutil | |
# Get current dir | |
dir_path = os.getcwd() | |
for root, dirs, files in os.walk(dir_path): | |
for file in files: |
NewerOlder