Searching for data objects

Applies to version 11.1.7 and subsequent versions unless specifically overridden. You can search for data objects in a notebook using the Python or R programming languages.

The search_data() method is used to find data objects so that they can be further processed using the CADataConnector.

The result provides a list of data objects and their connection paths, which may be copy/pasted for use with the various connection and access functions in the CADataConnector.

To search for data objects, specify the following code in a notebook cell:
In Python
data = CADataConnector.search_data(parameters as described in the following sections)
In R
data <- CADataConnector::search_data(parameters as described in the following sections)
Parameter Required or optional Description
query='search _term' optional

search _term can be any data object.

Tip: If no parameters are supplied, that is, CADataConnector.search_data(), all data objects available are selected, to a maximum of 50. See an example of the resulting output.
types=types optional

types can be replaced with any number of (separated by either '|' or ',' ) the following data object types:

  • uploadedFile
  • dataset
  • dataset2
  • module
  • package
Example:
types='module,dataset'

If types=types is not specified, the default is all of the types listed above.

max=number optional

number is any number greater than zero.

Example:
max=20
If max=number is not specified, the default is
max=50
Note: Use a higher number if you see a message that the maximum results were returned.
Note: You can use either single or double quotation marks in a method but not a mix of both.

Example output when no parameters are specified

When no parameters are supplied, the output appears in a list:

Results found: 50. ( see more results by using "max=" parameter with a number higher than 50 )

Type               Open path
package        .public_folders/Samples/Models/GO sales (analysis)
package        .public_folders/Samples_LG_DQ/Models/GO Data Warehouse (query)
package        .public_folders/Samples/Models/GO sales (query)
package        .public_folders/Samples_LG_DQ/Models/GO Sales (query)
package        .public_folders/Samples/Models/GO data warehouse (query)
package        .public_folders/Samples_LG_DQ/Models/GO Data Warehouse (analysis)
package        .public_folders/Samples/By feature/Audit
package        .public_folders/Samples/Models/GO data warehouse (analysis)
package        .public_folders/Samples_LG_DQ/Models/GO Sales (analysis)
package        .public_folders/Samples/Data/Sporting goods company
uploadedFile .public_folders/Samples/By feature/Notebooks/Data/Source files/Notebook data/Weather
uploadedFile .public_folders/Samples/By feature/Notebooks/Data/Source files/Hospital_floor_plan.xlsx
.....

Python notebook examples

CADataConnector.search_data('boston')

Returns everything with 'boston' in the name or data, to a maximum of the default number of results.

CADataConnector.search_data(types='module,package',max=100)

Returns only modules or packages to a maximum of 100 results.

CADataConnector.search_data(max=20)

Returns everything to a maximum of 20 results.

Note: All or none of the parameters may be used. If the query is to be used, it must be the first parameter. The other parameters are named and are not position-dependent.

R notebook examples

CADataConnector::search_data('boston')

Returns everything with 'boston' in the name or data, to a maximum of the default number of results.

CADataConnector::search_data(types='module,package',max=100)

Returns only modules or packages to a maximum of 100 results.

CADataConnector::search_data(max=20)

Returns everything to a maximum of 20 results.

Note: All or none of the parameters may be used. If the query is to be used, it must be the first parameter. The other parameters are named and are not position-dependent.