Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create load_multiple_explores.py #146

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions explore-assistant-examples/load_multiple_explores.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import os

# List of explore IDs to process
explore_ids = [
"sample_project:explore_id_1", # Example explore ID 1
"sample_project:explore_id_2", # Example explore ID 2
"sample_project:explore_id_3" # Example explore ID 3
]

# Common command template
base_command_template = (
"python load_examples.py "
"--project_id {project_id} "
"--explore_id {explore_id} "
"--table_id {table_id} "
"--json_file {json_file} "
)

# Command configurations for different tables and JSON files
commands = [
{"table_id": "example_table_1", "json_file": "example_file_1.json"},
{"table_id": "example_table_2", "json_file": "example_file_2.json"},
{"table_id": "example_table_3", "json_file": "example_file_3.json", "column_name": "example_column"}
]

# Define the project ID (replace with your project ID)
project_id = "sample_project_id"

# Iterate over explore IDs and commands
for explore_id in explore_ids:
for cmd in commands:
command = base_command_template.format(
project_id=project_id,
explore_id=explore_id,
table_id=cmd["table_id"],
json_file=cmd["json_file"]
)
# Add column_name if available
if "column_name" in cmd:
command += f"--column_name {cmd['column_name']} "

print(f"Running: {command}")
os.system(command)