StructuredDataDriver¶
- class inmydata.StructuredData.StructuredDataDriver(tenant: str, server: str = 'inmydata.com', logging_level=20, log_file: str | None = None)
Bases:
object
A driver class for interacting with structured data in the inmydata platform. This class provides methods to retrieve data based on subjects, fields, and filters. It uses the inmydata API to fetch data and returns it as a pandas DataFrame.
- tenant
The tenant identifier for the inmydata platform.
- Type:
str
- server
The server address for the inmydata platform, default is “inmydata.com”.
- Type:
str
- logging_level
The logging level for the logger, default is logging.INFO.
- Type:
int
- log_file
The file to log messages to, if None, logs will be printed to the console.
- Type:
Optional[str]
Members¶
- __init__(tenant: str, server: str = 'inmydata.com', logging_level=20, log_file: str | None = None)
Initializes the StructuredDataDriver with the specified tenant, server, logging level, and log file.
- Parameters:
tenant (str) – The tenant identifier for the inmydata platform.
server (str) – The server address for the inmydata platform, default is “inmydata.com”.
logging_level (int) – The logging level for the logger, default is logging.INFO.
log_file (Optional[str]) – The file to log messages to, if None, logs will be printed to the console.
- get_data(subject: str, fields: list[str], filters: list[AIDataFilter])
Retrieves data from the inmydata platform based on the specified subject, fields, and filters.
- Parameters:
subject (str) – The subject to query data from.
fields (list[str]) – The list of fields to retrieve.
filters (list[AIDataFilter]) – The list of filters to apply to the query.
- Returns:
A pandas DataFrame containing the retrieved data.
- Return type:
pd.DataFrame
- get_data_simple(subject: str, fields: list[str], simplefilters: list[AIDataSimpleFilter], caseSensitive: bool | None = True)
Retrieves data from the inmydata platform based on the specified subject, fields, and simple filters.
- Parameters:
subject (str) – The subject to query data from.
fields (list[str]) – The list of fields to retrieve.
simplefilters (list[AIDataSimpleFilter]) – The list of simple filters to apply to the query.
caseSensitive (Optional[bool]) – Whether the filter should be case sensitive. Defaults to True.
- Returns:
A pandas DataFrame containing the retrieved data.
- Return type:
pd.DataFrame