#!/usr/bin/env python3 """ Non-interactive configuration setup for Sigma API scripts """ import json from pathlib import Path def create_config_template(): """ Create a configuration template file """ config_template = { "base_url": "https://api.sigmacomputing.com", "client_id": "YOUR_CLIENT_ID_HERE", "snowflake_connection_name": "PROD_SIGMA_ORCHARD_SNOWFLAKE" } config_file = Path("sigma_config.json") with open(config_file, 'w') as f: json.dump(config_template, f, indent=2) print(f"Created configuration template: {config_file}") print("\nNext steps:") print("1. Edit sigma_config.json with your actual client_id") print("2. Set environment variable: export SIGMA_CLIENT_SECRET='your_secret_here'") print("3. Update base_url if you're not in the US region") print("\nAvailable regions:") print(" US: https://api.sigmacomputing.com") print(" EU: https://api.eu.sigmacomputing.com") print(" CA: https://api.ca.sigmacomputing.com") print(" UK: https://api.uk.sigmacomputing.com") print(" AU: https://api.au.sigmacomputing.com") return config_file def create_env_template(): """ Create an environment variables template """ env_template = """# Sigma API Configuration # Copy these lines to your shell profile or run them before using the scripts export SIGMA_CLIENT_ID="your_client_id_here" export SIGMA_CLIENT_SECRET="your_client_secret_here" export SIGMA_BASE_URL="https://api.sigmacomputing.com" export SIGMA_SNOWFLAKE_CONNECTION="PROD_SIGMA_ORCHARD_SNOWFLAKE" """ env_file = Path("sigma_env_template.sh") with open(env_file, 'w') as f: f.write(env_template) print(f"\nCreated environment template: {env_file}") print(f"To use: source {env_file} (after editing with your values)") return env_file def main(): print("Sigma API Configuration Setup") print("=" * 40) # Create configuration files config_file = create_config_template() env_file = create_env_template() print("\nConfiguration files created successfully!") print("\nTo get your API credentials:") print("1. Log into Sigma Computing") print("2. Go to Administration > Developer Access") print("3. Create a new API client") print("4. Copy the Client ID and Client Secret") print(f"\nFiles created:") print(f" - {config_file} (edit this with your client_id)") print(f" - {env_file} (source this after editing)") if __name__ == "__main__": main()