Strategy One
Import Data Using Python Query
Starting in Strategy One (January 2026), you can use Python queries to import data from a variety of sources, provided the necessary packages are installed and your Python runtime has network access. You can also use an AI assistant to automatically generate the Python code for your data connection.
-
Create a Mosaic model or edit an existing one.
-
If you do not have an existing Python query data source, perform the following:
-
In the Sources tab, click Add API Source.
-
Choose Python Query.
-
Type a Name.
-
Expand the Python Runtime drop-down list and choose a runtime. For more information on creating runtimes, see Create and Edit Python Runtimes.
-
Click Save.
-
-
Click your Python Query data source.
-
To confirm the available packages and network access, in Auto, click Show runtime packages installed or Show runtime network access.
If your Python runtime is missing the required packages or does not have network access, see Create and Edit Python Runtimes to update your Python runtime.
-
Type a message in the question box to generate Python code to connect to your data source.
For example, "
Write Python code to query Jira Cloud for all issues of type 'Defect', priority 'High', status not 'Closed' and created today.". -
Click Insert.
-
Review the code and make edits, as needed.
Ensure your Python code includes a
get_data()function that returns a data frame object. -
To preview the data, click Execute in the top-right.
-
Click Add Table.
-
Click Proceed.
-
Use the Prep and Model page to continue to create your Mosaic model using Data Preparation and to Accept and Dismiss Suggestions.
