Skip to content

Commit afc375c

Browse files
jorwoodsclaude
andcommitted
docs: add datasources.update_connection, update_connections, update_hyper_data, add_tags, delete_tags, update_tags, filter to api-ref.md
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 145c292 commit afc375c

File tree

1 file changed

+258
-0
lines changed

1 file changed

+258
-0
lines changed

docs/api-ref.md

Lines changed: 258 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,6 +1546,264 @@ result = server.datasources.schedule_extract_refresh('schedule-id-here', datasou
15461546
<br>
15471547
<br>
15481548

1549+
#### datasources.update_connection
1550+
1551+
```py
1552+
datasources.update_connection(datasource_item, connection_item)
1553+
```
1554+
1555+
Updates the server address, port, username, or password for the specified data source connection.
1556+
1557+
REST API: [Update Data Source Connection](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_data_sources.htm#update_data_source_connection)
1558+
1559+
**Parameters**
1560+
1561+
Name | Description
1562+
:--- | :---
1563+
`datasource_item` | The `DatasourceItem` to update.
1564+
`connection_item` | The `ConnectionItem` containing the updated connection details.
1565+
1566+
**Returns**
1567+
1568+
Returns the updated `ConnectionItem`, or `None` if no connection was returned.
1569+
1570+
**Example**
1571+
1572+
```py
1573+
server.datasources.populate_connections(datasource_item)
1574+
conn = datasource_item.connections[0]
1575+
conn.username = 'newuser'
1576+
updated_conn = server.datasources.update_connection(datasource_item, conn)
1577+
```
1578+
1579+
<br>
1580+
<br>
1581+
1582+
#### datasources.update_connections
1583+
1584+
```py
1585+
datasources.update_connections(datasource_item, connection_luids, authentication_type, username=None, password=None, embed_password=None)
1586+
```
1587+
1588+
Bulk updates one or more datasource connections by LUID.
1589+
1590+
**Version**
1591+
1592+
This endpoint is available with REST API version 3.26 and up.
1593+
1594+
**Parameters**
1595+
1596+
Name | Description
1597+
:--- | :---
1598+
`datasource_item` | The `DatasourceItem` containing the connections to update.
1599+
`connection_luids` | An iterable of connection LUIDs (strings) to update.
1600+
`authentication_type` | The authentication type to use (e.g., `'auth-keypair'`).
1601+
`username` | (Optional) The username to set.
1602+
`password` | (Optional) The password or secret to set.
1603+
`embed_password` | (Optional) Whether to embed the password.
1604+
1605+
**Returns**
1606+
1607+
Returns a list of updated `ConnectionItem` objects.
1608+
1609+
**Example**
1610+
1611+
```py
1612+
server.datasources.populate_connections(datasource_item)
1613+
luids = [conn.id for conn in datasource_item.connections]
1614+
updated = server.datasources.update_connections(datasource_item, luids, 'auth-keypair', username='myuser', password='mysecret')
1615+
```
1616+
1617+
<br>
1618+
<br>
1619+
1620+
#### datasources.update_hyper_data
1621+
1622+
```py
1623+
datasources.update_hyper_data(datasource_or_connection_item, *, request_id, actions, payload=None)
1624+
```
1625+
1626+
Incrementally updates data (insert, update, upsert, replace, or delete) in a published datasource from a live-to-Hyper connection.
1627+
1628+
For all connections to Parquet files and for datasources with a single connection, you can pass a `DatasourceItem`. For datasources with multiple connections, pass a `ConnectionItem` to target the specific connection.
1629+
1630+
REST API: [Update Data in Hyper Data Source](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_data_sources.htm#update_data_in_hyper_connection)
1631+
1632+
**Parameters**
1633+
1634+
Name | Description
1635+
:--- | :---
1636+
`datasource_or_connection_item` | A `DatasourceItem`, `ConnectionItem`, or datasource ID string. Use a `ConnectionItem` when the datasource has multiple connections.
1637+
`request_id` | A user-supplied string to uniquely identify the request. Duplicate requests with the same key are executed only once.
1638+
`actions` | A sequence of action mappings (insert, update, delete, etc.) specifying how to modify the data. See the [REST API documentation](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_how_to_update_data_to_hyper.htm#action-batch-descriptions) for action format.
1639+
`payload` | (Optional) Path to a Hyper file containing tuple data for the actions.
1640+
1641+
**Returns**
1642+
1643+
Returns a `JobItem` for the running job on the server.
1644+
1645+
**Example**
1646+
1647+
```py
1648+
actions = [{"action": "insert", "source-table": "my_table", "target-table": "my_table"}]
1649+
job = server.datasources.update_hyper_data(
1650+
datasource_item,
1651+
request_id='unique-request-id-001',
1652+
actions=actions,
1653+
payload='/path/to/data.hyper'
1654+
)
1655+
job = server.jobs.wait_for_job(job)
1656+
```
1657+
1658+
<br>
1659+
<br>
1660+
1661+
#### datasources.add_tags
1662+
1663+
```py
1664+
datasources.add_tags(item, tags)
1665+
```
1666+
1667+
Adds one or more tags to the specified datasource.
1668+
1669+
REST API: [Add Tags to Data Source](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_data_sources.htm#add_tags_to_data_source)
1670+
1671+
**Parameters**
1672+
1673+
Name | Description
1674+
:--- | :---
1675+
`item` | The `DatasourceItem` or datasource ID to add tags to.
1676+
`tags` | A single tag string or iterable of tag strings to add.
1677+
1678+
**Returns**
1679+
1680+
Returns a `set[str]` of the tags added.
1681+
1682+
**Example**
1683+
1684+
```py
1685+
server.datasources.add_tags(datasource_item, ['finance', 'quarterly'])
1686+
```
1687+
1688+
<br>
1689+
<br>
1690+
1691+
#### datasources.delete_tags
1692+
1693+
```py
1694+
datasources.delete_tags(item, tags)
1695+
```
1696+
1697+
Removes one or more tags from the specified datasource.
1698+
1699+
REST API: [Delete Tag from Data Source](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_data_sources.htm#delete_tag_from_data_source)
1700+
1701+
**Parameters**
1702+
1703+
Name | Description
1704+
:--- | :---
1705+
`item` | The `DatasourceItem` or datasource ID to remove tags from.
1706+
`tags` | A single tag string or iterable of tag strings to remove.
1707+
1708+
**Returns**
1709+
1710+
None.
1711+
1712+
**Example**
1713+
1714+
```py
1715+
server.datasources.delete_tags(datasource_item, 'finance')
1716+
```
1717+
1718+
<br>
1719+
<br>
1720+
1721+
#### datasources.update_tags
1722+
1723+
```py
1724+
datasources.update_tags(item)
1725+
```
1726+
1727+
Updates the tags on the server to match the tags on the specified datasource item. Changes to tags must be made on the `DatasourceItem.tags` attribute before calling this method.
1728+
1729+
**Parameters**
1730+
1731+
Name | Description
1732+
:--- | :---
1733+
`item` | The `DatasourceItem` whose tags to synchronize to the server.
1734+
1735+
**Returns**
1736+
1737+
None.
1738+
1739+
**Example**
1740+
1741+
```py
1742+
datasource_item.tags.add('quarterly')
1743+
server.datasources.update_tags(datasource_item)
1744+
```
1745+
1746+
<br>
1747+
<br>
1748+
1749+
#### datasources.filter
1750+
1751+
```py
1752+
datasources.filter(**kwargs)
1753+
```
1754+
1755+
Returns a list of datasources that match the specified filters. Fields and operators are passed as keyword arguments in the form `field_name=value` or `field_name__operator=value`.
1756+
1757+
**Supported fields and operators**
1758+
1759+
Field | Operators
1760+
:--- | :---
1761+
`authentication_type` | `eq`, `in`
1762+
`connected_workbook_type` | `eq`, `gt`, `gte`, `lt`, `lte`
1763+
`connection_to` | `eq`, `in`
1764+
`connection_type` | `eq`, `in`
1765+
`content_url` | `eq`, `in`
1766+
`created_at` | `eq`, `gt`, `gte`, `lt`, `lte`
1767+
`database_name` | `eq`, `in`
1768+
`database_user_name` | `eq`, `in`
1769+
`description` | `eq`, `in`
1770+
`favorites_total` | `eq`, `gt`, `gte`, `lt`, `lte`
1771+
`has_alert` | `eq`
1772+
`has_embedded_password` | `eq`
1773+
`has_extracts` | `eq`
1774+
`is_certified` | `eq`
1775+
`is_connectable` | `eq`
1776+
`is_default_port` | `eq`
1777+
`is_hierarchical` | `eq`
1778+
`is_published` | `eq`
1779+
`name` | `eq`, `in`
1780+
`owner_domain` | `eq`, `in`
1781+
`owner_email` | `eq`
1782+
`owner_name` | `eq`, `in`
1783+
`project_name` | `eq`, `in`
1784+
`server_name` | `eq`, `in`
1785+
`server_port` | `eq`
1786+
`size` | `eq`, `gt`, `gte`, `lt`, `lte`
1787+
`table_name` | `eq`, `in`
1788+
`tags` | `eq`, `in`
1789+
`type` | `eq`
1790+
`updated_at` | `eq`, `gt`, `gte`, `lt`, `lte`
1791+
1792+
**Returns**
1793+
1794+
Returns a `QuerySet` of `DatasourceItem` objects.
1795+
1796+
**Example**
1797+
1798+
```py
1799+
certified_ds = server.datasources.filter(is_certified=True, project_name='Finance')
1800+
for ds in certified_ds:
1801+
print(ds.name)
1802+
```
1803+
1804+
<br>
1805+
<br>
1806+
15491807
## Filters
15501808

15511809
The TSC library provides a `Filter` class that you can use to filter results returned from the server.

0 commit comments

Comments
 (0)