{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"redocly_category":"Treasure Code","product_name":"Treasure Code","type":"markdown"},"seo":{"title":"tdx table - Table Management | Treasure Data","description":"List, describe, and show Treasure Data table contents. View schemas and preview data.","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":"table-commands","__idx":0},"children":["Table Commands"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["List, describe, and show table contents."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"commands","__idx":1},"children":["Commands"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"tdx tables [pattern]              # List tables\ntdx table list [pattern]          # Same as tables\ntdx table deleted                 # List recoverable deleted tables\ntdx table recover <id>            # Recover a deleted table by id\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"pattern-syntax","__idx":2},"children":["Pattern Syntax"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["All table commands use dot-separated patterns: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["(database).(table)"]}]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Database wildcard: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"mydb.*\""]}," - all tables from mydb"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Database.table: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["mydb.users"]}," - specific table"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Wildcards: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"*.users\""]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"prod_*.user*\""]}," - pattern matching"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Catalog: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"td.mydb.users\""]}," - with catalog prefix"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"list-tables","__idx":3},"children":["List Tables"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# List all tables from all databases\ntdx tables\n\n# List all tables from specific database\ntdx tables \"mydb.*\"\n\n# Filter tables with pattern\ntdx tables \"mydb.user_*\"\n\n# Database pattern with table\ntdx tables \"prod_*.access_log\"\n\n# Wildcard database and table\ntdx tables \"*.user*\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"describe-table","__idx":4},"children":["Describe Table"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Show table schema:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# Using dot notation\ntdx describe mydb.users\ntdx desc mydb.users  # alias\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"show-table-contents","__idx":5},"children":["Show Table Contents"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Display table data (SELECT * with limit):"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# Show first 40 rows (default)\ntdx show mydb.users\n\n# With custom limit\ntdx show mydb.users --limit 10\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"recover-deleted-tables","__idx":6},"children":["Recover Deleted Tables"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Tables remain recoverable for ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["7 days"]}," after deletion. Use the workflow"," ","below to find a deleted table's id, then recover it."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# List your recoverable deleted tables (paginated)\ntdx table deleted\ntdx table deleted --page-size 50\ntdx table deleted --cursor-id 859018252   # next page\n\n# Recover by id (id comes from `tdx table deleted` or Premium Audit Logs)\ntdx table recover 859018252\n\n# If the original name conflicts with an active table or database, rename:\ntdx table recover 859018252 --name users_recovered\ntdx table recover 859018252 --database analytics_recovered\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"required-permissions","__idx":7},"children":["Required permissions"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You need one of the following on the parent database:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Database:edit"]}," (Full Access in the UI)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Database:owner_manage"]}," (you created the database)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Database:manage"]}," (administrator with explicit grant)"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If the parent database itself was also deleted, only users with"," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Database:manage"]}," can recover it — otherwise contact an administrator."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"limitations","__idx":8},"children":["Limitations"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Schema annotations are not recoverable (hard-deleted on table delete)."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Preview data is not recoverable; it repopulates on the next import."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Recovery is only available within the 7-day retention window."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"using-session-context","__idx":9},"children":["Using Session Context"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Set a default database to avoid repeating it in every command:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# Set session database\ntdx use database mydb\n\n# Now these commands use mydb automatically\ntdx tables        # Lists tables in mydb\ntdx describe users\ntdx show users --limit 10\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"examples","__idx":10},"children":["Examples"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# List tables in production databases\ntdx tables \"prod_*.*\"\n\n# Describe user tables across all databases\ntdx tables \"*.user*\"\n\n# Show sample data from specific table\ntdx show mydb.users --limit 5 --json\n\n# Export table schema\ntdx describe mydb.users --json --output schema.json\n","lang":"bash"},"children":[]}]},"headings":[{"value":"Table Commands","id":"table-commands","depth":1},{"value":"Commands","id":"commands","depth":2},{"value":"Pattern Syntax","id":"pattern-syntax","depth":2},{"value":"List Tables","id":"list-tables","depth":2},{"value":"Describe Table","id":"describe-table","depth":2},{"value":"Show Table Contents","id":"show-table-contents","depth":2},{"value":"Recover Deleted Tables","id":"recover-deleted-tables","depth":2},{"value":"Required permissions","id":"required-permissions","depth":3},{"value":"Limitations","id":"limitations","depth":3},{"value":"Using Session Context","id":"using-session-context","depth":2},{"value":"Examples","id":"examples","depth":2}],"frontmatter":{"seo":{"title":"tdx table - Table Management | Treasure Data","description":"List, describe, and show Treasure Data table contents. View schemas and preview data.","image":"/assets/og-image.ba836864a30434f560a4f7720f8a09019ad30ff828b20c5052ae933ba7121524.d7ef4821.png"}},"lastModified":"2026-05-18T01:25:54.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/treasure-code/commands/table","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}