GetDatabaseOption#

class teamworksams.database_option.GetDatabaseOption(interactive_mode: bool = True, cache: bool = True)[source]#

Bases: object

Options for retrieving database entries from an AMS database form.

Customizes the behavior of get_database(), controlling caching and interactive feedback. These options optimize performance and user experience for fetching database entries, such as allergies or equipment lists, typically used in one-off operations. See Database Operations for database workflows.

Parameters:
  • interactive_mode (bool) – If True, prints status messages during execution, such as “Retrieved 100 entries” or “No entries found,” useful for interactive environments like Jupyter notebooks. Set to False for silent execution. Defaults to True.

  • cache (bool) – If True, reuses cached API responses via the AMSClient, reducing API calls for repeated queries (e.g., fetching multiple pages). Set to False for fresh data. Defaults to True.

interactive_mode#

Whether interactive mode is enabled.

Type:

bool

cache#

Whether caching is enabled.

Type:

bool

Examples

>>> from teamworksams import GetDatabaseOption, get_database
>>> option = GetDatabaseOption(interactive_mode = True, cache = False)
>>> df = get_database(
...     form_name = "Allergies",
...     url = "https://example.smartabase.com/site",
...     option = option
... )
ℹ Fetching database entries for form 'Allergies'...
✔ Retrieved 100 database entries for form 'Allergies'.
__init__(interactive_mode: bool = True, cache: bool = True)[source]#

Additional Notes#

  • Enable interactive_mode=True for status messages like “Retrieved 100 entries,” useful for one-off queries in interactive environments.

  • Set cache=False to ensure fresh data when retrieving entries, especially if the AMS database form has been recently updated.

  • Use with get_database() for occasional data retrieval tasks, such as auditing or reporting.

See Also#