{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-@l10n/ja/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Profile Management - tdx | Treasure Data","description":"Manage multiple Treasure Data accounts with tdx profiles. Configure authentication, regions, and environment-specific settings.","siteUrl":"https://docs.treasuredata.com","lang":"en-US","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]},"image":"/assets/og-image.ba836864a30434f560a4f7720f8a09019ad30ff828b20c5052ae933ba7121524.d7ef4821.png"},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"profile-management","__idx":0},"children":["Profile Management"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx"]}," uses profiles to manage multiple Treasure AI accounts and environments. Each profile stores authentication credentials, region settings, and default configurations."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"what-is-a-profile","__idx":1},"children":["What is a Profile?"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A profile is a named configuration that includes:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Authentication"]}," — API key stored securely in your system keychain"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Region"]}," — Which TD site to connect to (us01, jp01, eu01, ap02)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Defaults"]}," — Optional settings like default database or LLM project"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"quick-start","__idx":2},"children":["Quick Start"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# Create a new profile\ntdx profile create production\n\n# List all profiles\ntdx profile list\n\n# Switch to a profile for the current session\ntdx profile use production\n\n# Or use --profile for one-off commands\ntdx --profile staging databases\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"creating-a-profile","__idx":3},"children":["Creating a Profile"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx profile create"]}," to set up a new profile with authentication:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# Create with name\ntdx profile create production\n\n# Or fully interactive\ntdx profile create\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The command will:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Guide you through site selection (us01, jp01, eu01, ap02)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Prompt for an optional description"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Securely prompt for your API key"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Validate the API key before saving"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Save credentials to your system keychain"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"credential-storage","__idx":4},"children":["Credential Storage"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["API keys are stored securely in your operating system's keychain:"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Platform"},"children":["Platform"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Storage Location"},"children":["Storage Location"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["macOS"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Keychain Access"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Windows"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Credential Manager"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Linux"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Secret Service (libsecret)"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"environment-variables","__idx":5},"children":["Environment Variables"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For CI/CD pipelines or headless environments where keychain is unavailable, use environment variables:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# Set the active profile\nexport TDX_PROFILE=production\n\n# Set the API key\nexport TDX_API_KEY=your-api-key-here\n\n# Or use an access token (Bearer auth, takes precedence over API key)\nexport TDX_ACCESS_TOKEN=your-access-token-here\n\n# [Advanced] Set the site/region (optional, overrides profile setting)\nexport TDX_SITE=us01\n\n# [Advanced] Set a stable session ID (useful for IDE terminals where PPID varies)\nexport TDX_SESSION=my-session\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#ci-cd-configuration"},"children":["CI/CD Configuration"]}," for complete setup examples."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"working-with-profiles","__idx":6},"children":["Working with Profiles"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"profile-commands","__idx":7},"children":["Profile Commands"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx profile"]}," command group provides all profile management operations:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# List all profiles\ntdx profile list\n\n# Create a new profile\ntdx profile create staging\n\n# Delete a profile\ntdx profile delete staging\n\n\n# Set session profile (for current shell)\ntdx profile use production\n\n# Set profile configuration (uses session profile, or specify with --profile)\ntdx profile set database=analytics\ntdx profile set description=\"Production environment\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"using-profiles","__idx":8},"children":["Using Profiles"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Once you have profiles set up, you can switch between them easily:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# Set session profile (shell-scoped)\ntdx profile use production\n\n# Set profile as permanent default (saves to ~/.config/tdx/tdx.json)\ntdx profile use production --default\n\n# Once profile is set, no --profile flag needed\ntdx databases\ntdx tables mydb\ntdx query \"SELECT * FROM mydb.users LIMIT 10\"\n\n# Or use --profile for one-off commands\ntdx --profile staging databases\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"profile-structure","__idx":9},"children":["Profile Structure"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Profiles are defined in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["~/.config/tdx/tdx.json"]},". When you run ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx profile create"]},", the profile entry is automatically created."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can also manually edit the file to add defaults like ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["database"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["llm_project"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"profiles\": {\n    \"production\": {\n      \"description\": \"Production environment for US region\",\n      \"site\": \"us01\",\n      \"database\": \"analytics\",\n      \"llm_project\": \"DataAnalytics\"\n    },\n    \"dev\": {\n      \"description\": \"Development and testing environment\",\n      \"site\": \"jp01\",\n      \"database\": \"dev_db\"\n    }\n  }\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"available-parameters","__idx":10},"children":["Available Parameters"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["These parameters can be set via ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx profile set <key>=<value>"]}," (uses session profile) or by editing ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx.json"]},":"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Parameter"},"children":["Parameter"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Example"},"children":["Example"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["description"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Optional description"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"Production environment\""]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["site"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["TD site/region (requires API key validation)"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"us01\""]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["database"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Default database"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"analytics\""]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["parent_segment"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Default parent segment"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"active_users\""]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["llm_project"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Default LLM project"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"DataAnalytics\""]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["llm_agent"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Default LLM agent"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"Assistant\""]}]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"session-context","__idx":11},"children":["Session Context"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Set temporary overrides for the current shell session:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# Set session database\ntdx use database mydb\n\n# Set session LLM project\ntdx use llm_project Analytics\n\n# View current context\ntdx use\n\n# Clear session context\ntdx use --clear\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"saving-default-profile","__idx":12},"children":["Saving Default Profile"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--default"]}," to save the default profile permanently to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["~/.config/tdx/tdx.json"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# Save default profile (persists across sessions)\ntdx use --default profile production\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"clearing-context","__idx":13},"children":["Clearing Context"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx unset"]}," to clear session or default context values:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# Clear session database\ntdx unset database\n\n# Clear session profile\ntdx unset profile\n\n# Clear default profile from config\ntdx unset --default profile\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Resources available for session context: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["database"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["parent_segment"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["llm_project"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["agent"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["profile"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["engage_workspace"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"how-session-scope-works","__idx":14},"children":["How Session Scope Works"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Sessions are automatically scoped to your current shell window. Each terminal window/tab has a unique process ID (PID), and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx"]}," uses the parent process ID (PPID) to identify and isolate sessions."]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Automatic isolation"]},": Each terminal window maintains its own independent session context"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["No manual setup"]},": Sessions are created automatically when you run ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx use"]}," commands"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Persistent within shell"]},": Context persists across multiple commands in the same terminal"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Automatic cleanup"]},": Sessions expire after 24 hours or when the shell is closed"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Example:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# Terminal Window 1\ntdx use database analytics\ntdx tables  # Uses database: analytics\n\n# Terminal Window 2 (different PID)\ntdx tables  # Uses default database (separate session)\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"project-config","__idx":15},"children":["Project Config"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Store per-project defaults in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx.json"]}," at your project root. This is useful for:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Per-folder database settings"]},": Different projects can use different databases without manual switching"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Shared team configuration"]},": Commit ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx.json"]}," to version control so all team members use the same defaults"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"database\": \"customer_analytics\",\n  \"parent_segment\": \"active_users\",\n  \"llm_project\": \"CustomerInsights\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"cicd-configuration","__idx":16},"children":["CI/CD Configuration"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For automated pipelines, combine project config with environment variables."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"share-profile-settings-via-tdxjson","__idx":17},"children":["Share Profile Settings via tdx.json"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Commit profile configurations in your project's ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx.json"]}," so CI/CD uses the same settings as your team:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"profile\": \"production\",\n  \"profiles\": {\n    \"production\": {\n      \"site\": \"us01\",\n      \"database\": \"analytics\",\n      \"parent_segment\": \"Customer 360\"\n    },\n    \"staging\": {\n      \"site\": \"us01\",\n      \"database\": \"staging_db\",\n      \"parent_segment\": \"Customer 360 (Staging)\"\n    }\n  }\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"set-profile-site-and-api-key-via-environment-variables","__idx":18},"children":["Set Profile, Site, and API Key via Environment Variables"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In your CI/CD platform, set the profile and API key as secrets:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# Set the active profile\nexport TDX_PROFILE=production\n\n# Set API key (profile-specific recommended)\nexport TDX_API_KEY_PRODUCTION=${{ secrets.TDX_API_KEY_PRODUCTION }}\n\n# Or generic (used when no profile specified)\nexport TDX_API_KEY=${{ secrets.TDX_API_KEY }}\n\n# [Advanced] Set the site/region (optional, overrides profile setting)\nexport TDX_SITE=us01\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Profile names in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TDX_API_KEY_<PROFILE>"]}," are normalized: uppercase with non-alphanumeric characters replaced by underscores."]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TDX_PROFILE=production"]}," → ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TDX_API_KEY_PRODUCTION"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TDX_PROFILE=my-test-profile"]}," → ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TDX_API_KEY_MY_TEST_PROFILE"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"example-github-actions","__idx":19},"children":["Example: GitHub Actions"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"yaml","header":{"controls":{"copy":{}}},"source":"jobs:\n  deploy-staging:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - uses: actions/setup-node@v4\n        with:\n          node-version: '22'\n\n      - name: Install tdx\n        run: npm install -g @treasuredata/tdx\n\n      - name: Deploy to staging\n        env:\n          TDX_PROFILE: staging\n          TDX_API_KEY_STAGING: ${{ secrets.TDX_API_KEY_STAGING }}\n        run: |\n          tdx sg push --dry-run\n          tdx sg push\n\n  deploy-production:\n    runs-on: ubuntu-latest\n    needs: deploy-staging\n    steps:\n      - uses: actions/checkout@v4\n      - uses: actions/setup-node@v4\n        with:\n          node-version: '22'\n\n      - name: Install tdx\n        run: npm install -g @treasuredata/tdx\n\n      - name: Deploy to production\n        env:\n          TDX_PROFILE: production\n          TDX_API_KEY_PRODUCTION: ${{ secrets.TDX_API_KEY_PRODUCTION }}\n        run: |\n          tdx sg push --dry-run\n          tdx sg push\n","lang":"yaml"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx.json"]}," in your repo provides ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["site"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["database"]},", and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["parent_segment"]}," for each profile. The environment variables provide profile selection and authentication."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"context-resolution-order","__idx":20},"children":["Context Resolution Order"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When you run a command, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx"]}," resolves settings from multiple sources:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["CLI flags"]}," (highest priority) — ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--database"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--profile"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--site"]},", etc."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Session context"]}," — Shell-scoped overrides set with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx use"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Environment variables"]}," — ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TDX_PROFILE"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TDX_SITE"]}," for CI/CD environments"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Project config"]}," — Per-project defaults in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["./tdx.json"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Profile config"]}," — Settings in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["~/.config/tdx/tdx.json"]}," for the active profile"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Global config"]}," (lowest priority) — Fallback defaults"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"credential-resolution-priority","__idx":21},"children":["Credential Resolution Priority"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When tdx needs a credential, it checks sources in this order:"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["When a profile is active"]}," (via ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--profile"]},", session, config, or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TDX_PROFILE"]},"):"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TDX_ACCESS_TOKEN_<NORMALIZED_PROFILE>"]}," environment variable (Bearer auth)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TDX_ACCESS_TOKEN"]}," environment variable (Bearer auth)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TDX_API_KEY_<NORMALIZED_PROFILE>"]}," environment variable"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Profile keychain credential"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TDX_API_KEY"]}," environment variable (CI/CD fallback)"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["When no profile:"]}]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TDX_ACCESS_TOKEN"]}," environment variable (Bearer auth)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TDX_API_KEY"]}," environment variable"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Default keychain credential"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When an access token is present, tdx uses ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Authorization: Bearer <token>"]}," instead of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Authorization: TD1 <apikey>"]},". This is useful for environments where OAuth tokens are provisioned externally."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Profile names are normalized for environment variables: uppercase with non-alphanumeric characters replaced by underscores."]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["production"]}," → ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TDX_API_KEY_PRODUCTION"]}," / ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TDX_ACCESS_TOKEN_PRODUCTION"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["my-test-profile"]}," → ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TDX_API_KEY_MY_TEST_PROFILE"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["@tdx-studio:us01:7060"]}," → ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TDX_API_KEY__TDX_STUDIO_US01_7060"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"view-context","__idx":22},"children":["View Context"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx status"]}," to see authentication, context, and configuration all at once:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"tdx status\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Example output:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"tdx profile: production (from CLI flag) (site: us01)\nRead credential from keychain (profile: production)\n✓ Authentication successful\n\nUser: user@example.com\nName: John Doe\nAccount ID: 12345\n\n[context]\nsite: us01 (profile: production)\ndatabase: analytics (session)\nllm_project: DataAnalytics (profile: production)\nprofile: production (active)\n\n[configuration files]\nSession: /Users/user/.config/tdx/sessions/12345.json ✓ (session: 12345)\nProject: none\nGlobal: /Users/user/.config/tdx/tdx.json ✓\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The profile source shows where the profile was selected from:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["(from CLI flag)"]}," — Set via ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--profile"]}," option"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["(from session)"]}," — Set via ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx profile use"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["(from config)"]}," — Set as default in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["~/.config/tdx/tdx.json"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["(from TDX_PROFILE env)"]}," — Set via environment variable"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can also use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx use"]}," to view or modify context:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# Show current context only\ntdx use\n\n# Set session database\ntdx use database mydb\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"advanced-session-id-option","__idx":23},"children":["Advanced: Session ID Option"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Session ID is resolved in this priority order:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--session"]}," flag"]}," (highest) — Explicit per-command override"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TDX_SESSION"]}," env var"]}," — Stable identity for IDE terminals"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Parent PID"]}," (default) — Automatic per-shell isolation"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"explicit-session-id","__idx":24},"children":["Explicit Session ID"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--session"]}," to share context across multiple processes or shells:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# Process 1: Set session with explicit ID\ntdx --session my-workflow use database analytics\n\n# Process 2: Reuse the same session\ntdx --session my-workflow tables\n# Uses database: analytics\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"tdx_session-environment-variable","__idx":25},"children":["TDX_SESSION Environment Variable"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Set ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TDX_SESSION"]}," for stable sessions in environments where PPID varies (IDE terminals, Treasure Studio):"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"export TDX_SESSION=my-workspace\ntdx use database analytics\ntdx tables  # Uses database: analytics\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use cases:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Sharing context between multiple terminal windows"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Maintaining consistent context in IDE terminals and Treasure Studio"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["CI/CD pipelines and scripting scenarios where session persistence is needed"]}]}]},"headings":[{"value":"Profile Management","id":"profile-management","depth":1},{"value":"What is a Profile?","id":"what-is-a-profile","depth":2},{"value":"Quick Start","id":"quick-start","depth":2},{"value":"Creating a Profile","id":"creating-a-profile","depth":2},{"value":"Credential Storage","id":"credential-storage","depth":3},{"value":"Environment Variables","id":"environment-variables","depth":3},{"value":"Working with Profiles","id":"working-with-profiles","depth":2},{"value":"Profile Commands","id":"profile-commands","depth":3},{"value":"Using Profiles","id":"using-profiles","depth":3},{"value":"Profile Structure","id":"profile-structure","depth":3},{"value":"Available Parameters","id":"available-parameters","depth":3},{"value":"Session Context","id":"session-context","depth":2},{"value":"Saving Default Profile","id":"saving-default-profile","depth":3},{"value":"Clearing Context","id":"clearing-context","depth":3},{"value":"How Session Scope Works","id":"how-session-scope-works","depth":3},{"value":"Project Config","id":"project-config","depth":2},{"value":"CI/CD Configuration","id":"cicd-configuration","depth":2},{"value":"Share Profile Settings via tdx.json","id":"share-profile-settings-via-tdxjson","depth":3},{"value":"Set Profile, Site, and API Key via Environment Variables","id":"set-profile-site-and-api-key-via-environment-variables","depth":3},{"value":"Example: GitHub Actions","id":"example-github-actions","depth":3},{"value":"Context Resolution Order","id":"context-resolution-order","depth":2},{"value":"Credential Resolution Priority","id":"credential-resolution-priority","depth":3},{"value":"View Context","id":"view-context","depth":2},{"value":"Advanced: Session ID Option","id":"advanced-session-id-option","depth":2},{"value":"Explicit Session ID","id":"explicit-session-id","depth":3},{"value":"TDX_SESSION Environment Variable","id":"tdx_session-environment-variable","depth":3}],"frontmatter":{"seo":{"title":"Profile Management - tdx | Treasure Data","description":"Manage multiple Treasure Data accounts with tdx profiles. Configure authentication, regions, and environment-specific settings.","image":"/assets/og-image.ba836864a30434f560a4f7720f8a09019ad30ff828b20c5052ae933ba7121524.d7ef4821.png"}},"lastModified":"2026-05-18T01:25:54.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/ja/treasure-code/guide/profile-management","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}