Skip to content

Commit 145c292

Browse files
jorwoodsclaude
andcommitted
docs: add missing Datasources methods to api-ref.md
Adds documentation for methods not previously documented: - create_extract / delete_extract - populate_permissions / update_permissions / delete_permission - populate_dqw / add_dqw / update_dqw / delete_dqw - populate_revisions / download_revision / delete_revision - schedule_extract_refresh Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 9162447 commit 145c292

File tree

1 file changed

+372
-0
lines changed

1 file changed

+372
-0
lines changed

docs/api-ref.md

Lines changed: 372 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,6 +1171,378 @@ A `JobItem` for the update job on the server. Upon completion of this job, the d
11711171
See the `update_datasource_data.py` sample in the Samples directory.
11721172

11731173

1174+
<br>
1175+
<br>
1176+
1177+
#### datasources.create_extract
1178+
1179+
```py
1180+
datasources.create_extract(datasource_item, encrypt=False)
1181+
```
1182+
1183+
Creates an extract for the specified data source.
1184+
1185+
**Parameters**
1186+
1187+
Name | Description
1188+
:--- | :---
1189+
`datasource_item` | The `DatasourceItem` to create an extract for.
1190+
`encrypt` | (Optional) Specifies whether to encrypt the extract. The default is `False`.
1191+
1192+
**Returns**
1193+
1194+
Returns a `JobItem` for the extract creation job.
1195+
1196+
**Version**
1197+
1198+
Version 3.5 and later. See [REST API versions](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_concepts_versions.htm).
1199+
1200+
**Example**
1201+
1202+
```py
1203+
datasource = server.datasources.get_by_id('1a2a3b4b-5c6c-7d8d-9e0e-1f2f3a4a5b6b')
1204+
job = server.datasources.create_extract(datasource, encrypt=True)
1205+
server.jobs.wait_for_job(job)
1206+
```
1207+
1208+
<br>
1209+
<br>
1210+
1211+
#### datasources.delete_extract
1212+
1213+
```py
1214+
datasources.delete_extract(datasource_item)
1215+
```
1216+
1217+
Removes the extract from the specified data source.
1218+
1219+
**Parameters**
1220+
1221+
Name | Description
1222+
:--- | :---
1223+
`datasource_item` | The `DatasourceItem` to remove the extract from.
1224+
1225+
**Version**
1226+
1227+
Version 3.5 and later. See [REST API versions](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_concepts_versions.htm).
1228+
1229+
**Example**
1230+
1231+
```py
1232+
datasource = server.datasources.get_by_id('1a2a3b4b-5c6c-7d8d-9e0e-1f2f3a4a5b6b')
1233+
server.datasources.delete_extract(datasource)
1234+
```
1235+
1236+
<br>
1237+
<br>
1238+
1239+
#### datasources.populate_permissions
1240+
1241+
```py
1242+
datasources.populate_permissions(datasource_item)
1243+
```
1244+
1245+
Populates the permissions for the specified data source.
1246+
1247+
**Parameters**
1248+
1249+
Name | Description
1250+
:--- | :---
1251+
`datasource_item` | The `DatasourceItem` to populate with permissions.
1252+
1253+
**Version**
1254+
1255+
Version 2.0 and later. See [REST API versions](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_concepts_versions.htm).
1256+
1257+
**Example**
1258+
1259+
```py
1260+
datasource = server.datasources.get_by_id('1a2a3b4b-5c6c-7d8d-9e0e-1f2f3a4a5b6b')
1261+
server.datasources.populate_permissions(datasource)
1262+
for permission in datasource.permissions:
1263+
print(permission.grantee_id, permission.capabilities)
1264+
```
1265+
1266+
<br>
1267+
<br>
1268+
1269+
#### datasources.update_permissions
1270+
1271+
```py
1272+
datasources.update_permissions(datasource_item, permission_item)
1273+
```
1274+
1275+
Adds or updates permissions for the specified data source.
1276+
1277+
**Parameters**
1278+
1279+
Name | Description
1280+
:--- | :---
1281+
`datasource_item` | The `DatasourceItem` to update permissions for.
1282+
`permission_item` | A list of `PermissionsRule` objects representing the permissions to add or update.
1283+
1284+
**Version**
1285+
1286+
Version 2.0 and later. See [REST API versions](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_concepts_versions.htm).
1287+
1288+
<br>
1289+
<br>
1290+
1291+
#### datasources.delete_permission
1292+
1293+
```py
1294+
datasources.delete_permission(datasource_item, capability_item)
1295+
```
1296+
1297+
Removes a permission from the specified data source.
1298+
1299+
**Parameters**
1300+
1301+
Name | Description
1302+
:--- | :---
1303+
`datasource_item` | The `DatasourceItem` to remove the permission from.
1304+
`capability_item` | The `PermissionsRule` object representing the permission to remove.
1305+
1306+
**Version**
1307+
1308+
Version 2.0 and later. See [REST API versions](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_concepts_versions.htm).
1309+
1310+
<br>
1311+
<br>
1312+
1313+
#### datasources.populate_dqw
1314+
1315+
```py
1316+
datasources.populate_dqw(datasource_item)
1317+
```
1318+
1319+
Populates the data quality warnings for the specified data source.
1320+
1321+
**Parameters**
1322+
1323+
Name | Description
1324+
:--- | :---
1325+
`datasource_item` | The `DatasourceItem` to populate with data quality warnings.
1326+
1327+
**Version**
1328+
1329+
Version 3.5 and later. See [REST API versions](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_concepts_versions.htm).
1330+
1331+
**Example**
1332+
1333+
```py
1334+
datasource = server.datasources.get_by_id('1a2a3b4b-5c6c-7d8d-9e0e-1f2f3a4a5b6b')
1335+
server.datasources.populate_dqw(datasource)
1336+
for dqw in datasource.dqws:
1337+
print(dqw.message)
1338+
```
1339+
1340+
<br>
1341+
<br>
1342+
1343+
#### datasources.add_dqw
1344+
1345+
```py
1346+
datasources.add_dqw(datasource_item, warning)
1347+
```
1348+
1349+
Adds a data quality warning to the specified data source.
1350+
1351+
**Parameters**
1352+
1353+
Name | Description
1354+
:--- | :---
1355+
`datasource_item` | The `DatasourceItem` to add the data quality warning to.
1356+
`warning` | The `DQWItem` object representing the data quality warning to add.
1357+
1358+
**Version**
1359+
1360+
Version 3.5 and later. See [REST API versions](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_concepts_versions.htm).
1361+
1362+
<br>
1363+
<br>
1364+
1365+
#### datasources.update_dqw
1366+
1367+
```py
1368+
datasources.update_dqw(datasource_item, warning)
1369+
```
1370+
1371+
Updates a data quality warning on the specified data source.
1372+
1373+
**Parameters**
1374+
1375+
Name | Description
1376+
:--- | :---
1377+
`datasource_item` | The `DatasourceItem` to update the data quality warning on.
1378+
`warning` | The `DQWItem` object representing the updated data quality warning.
1379+
1380+
**Version**
1381+
1382+
Version 3.5 and later. See [REST API versions](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_concepts_versions.htm).
1383+
1384+
<br>
1385+
<br>
1386+
1387+
#### datasources.delete_dqw
1388+
1389+
```py
1390+
datasources.delete_dqw(datasource_item)
1391+
```
1392+
1393+
Removes all data quality warnings from the specified data source.
1394+
1395+
**Parameters**
1396+
1397+
Name | Description
1398+
:--- | :---
1399+
`datasource_item` | The `DatasourceItem` to remove data quality warnings from.
1400+
1401+
**Version**
1402+
1403+
Version 3.5 and later. See [REST API versions](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_concepts_versions.htm).
1404+
1405+
<br>
1406+
<br>
1407+
1408+
#### datasources.populate_revisions
1409+
1410+
```py
1411+
datasources.populate_revisions(datasource_item)
1412+
```
1413+
1414+
Populates the revision history for the specified data source.
1415+
1416+
**Parameters**
1417+
1418+
Name | Description
1419+
:--- | :---
1420+
`datasource_item` | The `DatasourceItem` to populate with revision history.
1421+
1422+
**Exceptions**
1423+
1424+
Error | Description
1425+
:--- | :---
1426+
`Datasource item missing ID. Datasource must be retrieved from server first.` | Raises an exception if the `datasource_item` does not have an id.
1427+
1428+
**Version**
1429+
1430+
Version 2.3 and later. See [REST API versions](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_concepts_versions.htm).
1431+
1432+
**Example**
1433+
1434+
```py
1435+
datasource = server.datasources.get_by_id('1a2a3b4b-5c6c-7d8d-9e0e-1f2f3a4a5b6b')
1436+
server.datasources.populate_revisions(datasource)
1437+
for revision in datasource.revisions:
1438+
print(revision.revision_number, revision.created_at)
1439+
```
1440+
1441+
<br>
1442+
<br>
1443+
1444+
#### datasources.download_revision
1445+
1446+
```py
1447+
datasources.download_revision(datasource_id, revision_number, filepath=None, include_extract=True)
1448+
```
1449+
1450+
Downloads a specific revision of the specified data source.
1451+
1452+
**Parameters**
1453+
1454+
Name | Description
1455+
:--- | :---
1456+
`datasource_id` | The identifier (`id`) for the `DatasourceItem`.
1457+
`revision_number` | The revision number to download. Pass `None` to download the current (latest) revision.
1458+
`filepath` | (Optional) Downloads the file to the location you specify. If no location is specified (the default is `filepath=None`), the file is downloaded to the current working directory.
1459+
`include_extract` | (Optional) Specifies whether to download the file with the extract. The default is `True`.
1460+
1461+
**Exceptions**
1462+
1463+
Error | Description
1464+
:--- | :---
1465+
`Datasource ID undefined` | Raises an exception if a valid `datasource_id` is not provided.
1466+
1467+
**Returns**
1468+
1469+
The file path to the downloaded data source revision.
1470+
1471+
**Version**
1472+
1473+
Version 2.3 and later. See [REST API versions](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_concepts_versions.htm).
1474+
1475+
**Example**
1476+
1477+
```py
1478+
file_path = server.datasources.download_revision(
1479+
'1a2a3b4b-5c6c-7d8d-9e0e-1f2f3a4a5b6b',
1480+
revision_number='2'
1481+
)
1482+
print("\nDownloaded revision to {0}.".format(file_path))
1483+
```
1484+
1485+
<br>
1486+
<br>
1487+
1488+
#### datasources.delete_revision
1489+
1490+
```py
1491+
datasources.delete_revision(datasource_id, revision_number)
1492+
```
1493+
1494+
Removes a specific revision of the specified data source from Tableau Server.
1495+
1496+
**Parameters**
1497+
1498+
Name | Description
1499+
:--- | :---
1500+
`datasource_id` | The identifier (`id`) for the `DatasourceItem`.
1501+
`revision_number` | The revision number to delete.
1502+
1503+
**Version**
1504+
1505+
Version 2.3 and later. See [REST API versions](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_concepts_versions.htm).
1506+
1507+
**Example**
1508+
1509+
```py
1510+
server.datasources.delete_revision('1a2a3b4b-5c6c-7d8d-9e0e-1f2f3a4a5b6b', '2')
1511+
```
1512+
1513+
<br>
1514+
<br>
1515+
1516+
#### datasources.schedule_extract_refresh
1517+
1518+
```py
1519+
datasources.schedule_extract_refresh(schedule_id, item)
1520+
```
1521+
1522+
Convenience method to add a data source to an existing extract refresh schedule.
1523+
1524+
**Parameters**
1525+
1526+
Name | Description
1527+
:--- | :---
1528+
`schedule_id` | The identifier of the schedule to add the data source to.
1529+
`item` | The `DatasourceItem` to add to the schedule.
1530+
1531+
**Returns**
1532+
1533+
Returns a list of `AddResponse` objects.
1534+
1535+
**Version**
1536+
1537+
Version 2.8 and later. See [REST API versions](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_concepts_versions.htm).
1538+
1539+
**Example**
1540+
1541+
```py
1542+
datasource = server.datasources.get_by_id('1a2a3b4b-5c6c-7d8d-9e0e-1f2f3a4a5b6b')
1543+
result = server.datasources.schedule_extract_refresh('schedule-id-here', datasource)
1544+
```
1545+
11741546
<br>
11751547
<br>
11761548

0 commit comments

Comments
 (0)