mgnipy.V2.mgnifier.query_set module#
- class QuerySet(resource, *, config=None, params=None, **param_kwargs)[source]#
Bases:
objectQuery Builder and State Manager for MGnify API interactions.
Builds a set of .build_queries() that represent the API calls to be made based on the current resource (API endpoint) and parameters.
Stores the current state of the query set (including the resource type, parameters) and any results.
- Parameters:
resource (str ) – The type of resource to query (e.g., “studies”, “samples”, “runs”, etc.).
config (MGnipyConfig, optional) – Configuration object for MGnipy, including settings like base URL and authentication.
params (dict , optional) – A dictionary of parameters to include in the API request. These will be used to filter results.
**param_kwargs – Additional keyword arguments that will be merged into the params dictionary. These provide a convenient way to specify parameters directly when initializing the QuerySet.
- resource#
The type of resource being queried, represented as an instance of SupportedEndpoints.
- Type:
SupportedEndpoints
- config#
The configuration for MGnipy, including settings like base URL and authentication.
- Type:
- emgapi_handler#
The handler for interacting with the EMGAPI module.
- Type:
- filter(**filters) QuerySet[source]#
Return a new QuerySet instance with updated parameters for filtering results.
- Return type:
- list_urls() list [str ][source]#
Generate and return a list of URLs for all the API requests that would be made to retrieve the data based on the current parameters.
- queries(**httpx_kwargs) list [dict [str , Any]]#
Generate a list of query parameter dictionaries for each API request that would be made based on the current parameters.
- build_queries(**httpx_kwargs)[source]#
Generate a list of query parameter dictionaries for each API request that would be made based on the current parameters. This allows the user to see the specific query parameters for each request before executing them.
- config: MGnipyConfig#
- emgapi_handler: DescribeEmgapiModule#
- property endpoint_module: ModuleType #
- filter(**filters)[source]#
Update the parameters for the API call to filter results.
- Parameters:
**filters – Keyword arguments corresponding to the supported parameters for the current resource. These will be used to filter the results returned by the API.
- Returns:
A new QuerySet instance with updated parameters for filtering results.
- Return type:
- list_urls()[source]#
Generate and return a list of URLs for all the API requests that would be made to retrieve the data based on the current parameters. This allows the user to see exactly which endpoints and query parameters will be used in the API calls before executing them.
- property params: dict [str , Any ]#
Get the current parameters for the API request. These parameters are used to filter results and construct the request URL.
- property request_url: str #
Get the request URL to API based on the current resource and parameters.
This is a single URL that represents the request for the current page of results.
- Returns:
The constructed URL for the API request.
- Return type:
- property resource: SupportedEndpoints#
The type of resource being queried, represented as an instance of SupportedEndpoints.