Skip to content

Add a sample that explores databases and tables - #1907

Open
jacalata wants to merge 4 commits into
developmentfrom
jac/sample-databases-tables
Open

jacalata wants to merge 4 commits into
developmentfrom
jac/sample-databases-tables

Conversation

@jacalata

Copy link
Copy Markdown
Contributor

Summary

  • Adds a read-only sample that lists databases, shows a database's tables, lists a table's columns, and optionally prints permissions.
  • Tables are found through the Metadata API, because databases.populate_tables is not supported.
  • Initializes ColumnItem.remote_type to None. Reading it raised AttributeError when the server response did not include remoteType.

Refs #735

🤖 Generated with Claude Code

jacalata and others added 2 commits November 9, 2026 13:54
Add a read-only sample that lists databases, shows a database's tables
(found through the Metadata API, since databases.populate_tables is not
enabled), lists a table's columns, and optionally prints permissions.

Part of #735

Co-Authored-By: Claude Code <noreply@anthropic.com>
Reading remote_type raised AttributeError when the server response did
not include remoteType, because the attribute was only set from the
response. Default it to None, and add a test.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 10, 2026 05:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Coverage

Coverage Report
FileStmtsMissCoverMissing
tableauserverclient
   __init__.py50100% 
   config.py150100% 
   datetime_helpers.py2511 96%
   exponential_backoff.py200100% 
   filesys_helpers.py310100% 
   namespace.py2533 88%
tableauserverclient/bin
   __init__.py20100% 
   _version.py358212212 41%
tableauserverclient/helpers
   __init__.py10100% 
   logging.py20100% 
   strings.py3111 97%
tableauserverclient/models
   __init__.py470100% 
   auth_federation_item.py8799 90%
   collection_item.py4177 83%
   column_item.py562626 54%
   connection_credentials.py351111 69%
   connection_item.py1131313 88%
   custom_view_item.py1442121 85%
   data_acceleration_report_item.py5411 98%
   data_alert_item.py15844 97%
   data_freshness_policy_item.py1551515 90%
   database_item.py2073636 83%
   datasource_item.py3001212 96%
   dqw_item.py10455 95%
   exceptions.py40100% 
   extensions_item.py13244 97%
   extract_item.py4444 91%
   favorites_item.py6988 88%
   fileupload_item.py190100% 
   flow_item.py1491010 93%
   flow_run_item.py710100% 
   group_item.py8966 93%
   groupset_item.py4977 86%
   interval_item.py1823232 82%
   job_item.py1921010 95%
   linked_tasks_item.py7911 99%
   location_item.py2922 93%
   metric_item.py1291313 90%
   oidc_item.py6333 95%
   pagination_item.py3411 97%
   permissions_item.py1111212 89%
   project_item.py2073131 85%
   property_decorators.py1001818 82%
   reference_item.py2622 92%
   revision_item.py5911 98%
   schedule_item.py20966 97%
   server_info_item.py3777 81%
   site_item.py6361313 98%
   subscription_item.py10111 99%
   table_item.py1191818 85%
   tableau_auth.py612525 59%
   tableau_types.py2711 96%
   tag_item.py150100% 
   target.py60100% 
   task_item.py5922 97%
   user_item.py3381717 95%
   view_item.py2201616 93%
   virtual_connection_item.py6488 88%
   webhook_item.py11133 97%
   workbook_item.py3691616 96%
tableauserverclient/server
   __init__.py90100% 
   exceptions.py40100% 
   filter.py2911 97%
   pager.py3311 97%
   query.py1431313 91%
   request_factory.py1401188188 87%
   request_options.py38655 99%
   server.py2582222 91%
   sort.py60100% 
tableauserverclient/server/endpoint
   __init__.py360100% 
   auth_endpoint.py1141010 91%
   auth_federation_endpoint.py800100% 
   custom_views_endpoint.py1521212 92%
   data_acceleration_report_endpoint.py210100% 
   data_alert_endpoint.py942323 76%
   databases_endpoint.py1112929 74%
   datasources_endpoint.py3233333 90%
   default_permissions_endpoint.py4633 93%
   dqw_endpoint.py451616 64%
   endpoint.py2602222 92%
   exceptions.py7966 92%
   extensions_endpoint.py310100% 
   favorites_endpoint.py942222 77%
   fileuploads_endpoint.py510100% 
   flow_runs_endpoint.py6299 85%
   flow_task_endpoint.py2122 90%
   flows_endpoint.py1984747 76%
   groups_endpoint.py12699 93%
   groupsets_endpoint.py7277 90%
   jobs_endpoint.py6899 87%
   linked_tasks_endpoint.py370100% 
   metadata_endpoint.py881414 84%
   metrics_endpoint.py5566 89%
   oidc_endpoint.py4211 98%
   permissions_endpoint.py4433 93%
   projects_endpoint.py1792424 87%
   resource_tagger.py1273535 72%
   schedules_endpoint.py1531414 91%
   server_info_endpoint.py361010 72%
   sites_endpoint.py1302727 79%
   subscriptions_endpoint.py561414 75%
   tables_endpoint.py1103636 67%
   tasks_endpoint.py6366 90%
   users_endpoint.py17077 96%
   views_endpoint.py17399 95%
   virtual_connections_endpoint.py1131010 91%
   webhooks_endpoint.py6844 94%
   workbooks_endpoint.py3382222 93%
TOTAL12560140689% 

…e_type comment

Co-Authored-By: Claude Code <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 12, 2026 20:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

- List every database with TSC.Pager instead of only the first page.
- Exit with an error when --database-name matches no database.
- Treat a null tables list from the Metadata API as no tables, and
  report GraphQL errors instead of failing on them.

Written with Claude Code
jacalata added a commit that referenced this pull request Nov 14, 2026
- DatabaseItem.content_permissions: drop the value list and the claim
  that databases.update sends it (not true on development; the write
  and the LockedToDatabase value come with #1901).
- Drop the explore_databases_tables.py references (sample is in #1907).
- Handle empty results in the databases.populate_tables example.

Co-Authored-By: Claude Code <noreply@anthropic.com>
jacalata added a commit that referenced this pull request Nov 14, 2026
* Document the Databases and Tables endpoints

The databases and tables endpoints, and the DatabaseItem, TableItem and
ColumnItem classes, had no API reference entries. Add sections for every
method, note that databases.populate_tables is not enabled and show the
Metadata API alternative, and list the new explore_databases_tables
sample.

Closes #735

Co-Authored-By: Claude Code <noreply@anthropic.com>

* Fix datasources.delete_dqw REST API link

The link pointed at the delete_dqw_triggers anchor, which is not the
method this call makes. Point it at delete_dqws, Delete Data Quality
Warning by Content, and correct the link text.

Co-Authored-By: Claude Code <noreply@anthropic.com>

* Update Databases and Tables docs to match the fixed behavior

populate_tables raises NotImplementedError rather than gating on a
placeholder version. delete_table_default_permissions takes (item, rule),
and the old order warns. Update requests send only the values that are
set, so None leaves a property unchanged and an empty string clears it.

Refs #735

Co-Authored-By: Claude Code <noreply@anthropic.com>

* Correct databases and tables field and tag docs

content_permissions and description are sent by update, and an empty
description clears it. update_tags raises EndpointUnavailableError below
REST API 3.9.

Co-Authored-By: Claude Code <noreply@anthropic.com>

* Match databases docs to the code on development

Revert the two passages that describe unmerged #1901 behavior:
- databases.populate_tables is documented as not currently enabled
  (version 99 gate, EndpointUnavailableError), not as unsupported.
- databases.delete_table_default_permissions is documented as
  (rule, item), not (item, rule), and the tables property row
  matches the populate_tables wording.

Co-Authored-By: Claude Code <noreply@anthropic.com>

* Match database and table update docs to the code on development

databases.update and tables.update send a value only when it is not
empty on development, so the update docs say that empty strings do not
clear description or certification_note. Revert the "only the values
that are set" wording, which depends on unmerged #1901.

Co-Authored-By: Claude Code <noreply@anthropic.com>

* Remove docs that depend on other PRs; guard the metadata example

- DatabaseItem.content_permissions: drop the value list and the claim
  that databases.update sends it (not true on development; the write
  and the LockedToDatabase value come with #1901).
- Drop the explore_databases_tables.py references (sample is in #1907).
- Handle empty results in the databases.populate_tables example.

Co-Authored-By: Claude Code <noreply@anthropic.com>

---------

Co-authored-by: Claude Code <noreply@anthropic.com>
jacalata added a commit that referenced this pull request Nov 14, 2026
Do not merge before both PRs land:
- #1901 (databases and tables fixes): populate_tables raises
  NotImplementedError, delete_table_default_permissions takes
  (item, rule), update sends only the values that are set,
  content_permissions is sent and accepts LockedToDatabase.
- #1907 (databases and tables sample): the explore_databases_tables.py
  references.

Also guard the databases.populate_tables example against empty results,
matching #1902.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings December 3, 2026 03:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified in the database exploration sample or column remote-type initialization changes.

No open issues 🎉

Review effort: Balanced

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants