|
| 1 | +--- |
| 2 | +title: Environment Variables |
| 3 | +layout: docs |
| 4 | +--- |
| 5 | + |
| 6 | +Tableau Server Client (TSC) can use environment variables to pull configuration |
| 7 | +settings. This is a convenient way to manage the setting in one place and have |
| 8 | +it used across all of the related calls. |
| 9 | + |
| 10 | +## Supported environment variables |
| 11 | + |
| 12 | +The following environment variables are supported by TSC: |
| 13 | + |
| 14 | +Name | Description | Version | Default | Limit |
| 15 | +:--- | :--- | :--- | :--- | :--- |
| 16 | +`TSC_CHUNK_SIZE_MB` | The size of chunks when uploading files. Limit is 64 MB. | 0.33 | 50 | 64 |
| 17 | +`TSC_PAGE_SIZE` | The number of items to return in a single page of results. | 0.33 | 100 | 1000 |
| 18 | + |
| 19 | +## Setting environment variables |
| 20 | + |
| 21 | +To set an environment variable, you can use the `os` module in Python. Here is |
| 22 | +an example of setting the environment variables for the chunk size and page size: |
| 23 | + |
| 24 | +```py |
| 25 | +import os |
| 26 | + |
| 27 | +import tableauserverclient as TSC |
| 28 | + |
| 29 | +os.environ['TSC_CHUNK_SIZE_MB'] = '64' |
| 30 | +os.environ['TSC_PAGE_SIZE'] = '1000' |
| 31 | + |
| 32 | +# Continue with your TSC code |
| 33 | +``` |
| 34 | + |
| 35 | +You can set these environment variables in your Python script, shell, IDE, bash |
| 36 | +or PowerShell profile, CI/CD pipeline, .env file, or any other place where you |
| 37 | +can set environment variables. |
| 38 | + |
| 39 | +## Using environment variables |
| 40 | + |
| 41 | +The TSC library will automatically pick up the environment variables when they |
| 42 | +are set. If you set the environment variables in your Python script, they will |
| 43 | +be used for the duration of the script. If you set them in your shell or IDE, |
| 44 | +they will be used for all scripts that run in that environment. |
0 commit comments