:py:mod:`rhino_health.lib.endpoints.sql_query.sql_query_dataclass` ================================================================== .. py:module:: rhino_health.lib.endpoints.sql_query.sql_query_dataclass Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: rhino_health.lib.endpoints.sql_query.sql_query_dataclass.QueryResultStatus rhino_health.lib.endpoints.sql_query.sql_query_dataclass.SQLServerTypes rhino_health.lib.endpoints.sql_query.sql_query_dataclass.ConnectionDetails rhino_health.lib.endpoints.sql_query.sql_query_dataclass.SQLQueryInput rhino_health.lib.endpoints.sql_query.sql_query_dataclass.SQLQueryImportInput rhino_health.lib.endpoints.sql_query.sql_query_dataclass.SQLQuery .. py:class:: QueryResultStatus Bases: :py:obj:`str`, :py:obj:`enum.Enum` The status of the SQLQuery .. !! processed by numpydoc !! .. py:attribute:: INITIALIZING :value: 'Initializing' .. py:attribute:: STARTED :value: 'Started' .. py:attribute:: COMPLETED :value: 'Completed' .. py:attribute:: FAILED :value: 'Failed' .. py:class:: SQLServerTypes Bases: :py:obj:`str`, :py:obj:`enum.Enum` Supported sql server Types .. !! processed by numpydoc !! .. py:attribute:: POSTGRESQL :value: 'postgresql' .. py:attribute:: MARIADB :value: 'mariadb' .. py:attribute:: MYSQL :value: 'mysql' .. py:attribute:: ORACLE :value: 'oracle' .. py:attribute:: SQLITE :value: 'sqlite' .. py:class:: ConnectionDetails(**data: Any) Bases: :py:obj:`pydantic.BaseModel` Defines the connection details for an external SQL DB .. !! processed by numpydoc !! .. py:attribute:: server_url :type: str URL of the SQL server to query eg. myserverurl:5432 .. !! processed by numpydoc !! .. py:attribute:: server_user :type: str The user to connect to the target SQL server .. !! processed by numpydoc !! .. py:attribute:: server_type :type: SQLServerTypes The type of the SQL server to query .. !! processed by numpydoc !! .. py:attribute:: db_name :type: str The name of the database to query .. !! processed by numpydoc !! .. py:attribute:: password :type: str The user password to connect to the target SQL server .. !! processed by numpydoc !! .. py:class:: SQLQueryInput(**data) Bases: :py:obj:`SQLQueryBase` Input parameters for running a metrics on a query in an external SQL DB .. seealso:: :obj:`rhino_health.lib.endpoints.sql_query.sql_query_endpoints.SQLQueryEndpoints.run_sql_query` .. .. !! processed by numpydoc !! .. py:attribute:: metric_definitions :type: List[rhino_health.lib.metrics.base_metric.BaseMetric] The metric definitions to run on the SQL query .. !! processed by numpydoc !! .. py:attribute:: connection_details :type: ConnectionDetails The connection details to the SQL server .. !! processed by numpydoc !! .. py:attribute:: timeout_seconds :type: int The timeout in seconds for the query to run .. !! processed by numpydoc !! .. py:attribute:: project_uid :type: typing_extensions.Annotated[str, Field(alias='project')] The unique ID of the project in whose context this query is done .. !! processed by numpydoc !! .. py:attribute:: workgroup_uid :type: typing_extensions.Annotated[str, Field(alias='workgroup')] The unique ID of the Workgroup in whose context this query is done .. !! processed by numpydoc !! .. py:attribute:: sql_query :type: str Sql query to run .. !! processed by numpydoc !! .. py:class:: SQLQueryImportInput(**data) Bases: :py:obj:`SQLQueryBase` Input parameters for importing a dataset form query run on external SQL DB .. seealso:: :obj:`rhino_health.lib.endpoints.sql_query.sql_query_endpoints.SQLQueryEndpoints.run_sql_query` .. .. !! processed by numpydoc !! .. py:attribute:: dataset_name :type: str The name of the dataset to create .. !! processed by numpydoc !! .. py:attribute:: is_data_deidentified :type: bool Whether the data is deidentified or not .. !! processed by numpydoc !! .. py:attribute:: connection_details :type: ConnectionDetails The connection details to the SQL server .. !! processed by numpydoc !! .. py:attribute:: data_schema_uid :type: typing_extensions.Annotated[Any, Field(alias='data_schema')] The unique ID of the data_schema in whose context this query is done .. !! processed by numpydoc !! .. py:attribute:: timeout_seconds :type: int The timeout in seconds for the query to run .. !! processed by numpydoc !! .. py:attribute:: project_uid :type: typing_extensions.Annotated[str, Field(alias='project')] The unique ID of the project in whose context this query is done .. !! processed by numpydoc !! .. py:attribute:: workgroup_uid :type: typing_extensions.Annotated[str, Field(alias='workgroup')] The unique ID of the Workgroup in whose context this query is done .. !! processed by numpydoc !! .. py:attribute:: sql_query :type: str Sql query to run .. !! processed by numpydoc !! .. py:class:: SQLQuery(**data) Bases: :py:obj:`rhino_health.lib.endpoints.project.project_baseclass.WithinProjectModel`, :py:obj:`rhino_health.lib.endpoints.workgroup.workgroup_baseclass.WithinWorkgroupModel`, :py:obj:`SQLQueryBase`, :py:obj:`rhino_health.lib.endpoints.user.user_baseclass.UserCreatedModel` An SQL query run which exists on the platform .. !! processed by numpydoc !! .. py:property:: project :type: Project Return the Project Dataclass associated with project_uid .. warning:: The result of this function is cached. Be careful calling this function after making changes. All dataclasses must already exist on the platform before making this call. :Returns: project: Project Dataclass representing the Project .. py:property:: workgroup :type: Workgroup Return the Workgroup Dataclass associated with workgroup_uid .. warning:: The result of this function is cached. Be careful calling this function after making changes. All dataclasses must already exist on the platform before making this call. :Returns: workgroup: Workgroup Dataclass representing the Workgroup .. py:property:: creator :type: User Return the User Dataclass associated with creator_uid .. warning:: The result of this function is cached. Be careful calling this function after making changes. All dataclasses must already exist on the platform before making this call. :Returns: creator: User Dataclass representing the User .. py:attribute:: uid :type: str The Unique ID of the DICOMweb Query .. !! processed by numpydoc !! .. py:attribute:: status :type: str The query status .. !! processed by numpydoc !! .. py:attribute:: ended_at :type: Optional[str] When this query ended .. !! processed by numpydoc !! .. py:attribute:: results :type: Optional[Any] The results of this query .. !! processed by numpydoc !! .. py:attribute:: errors :type: Optional[List[str]] Errors that occurred while running this query .. !! processed by numpydoc !! .. py:attribute:: connection_details :type: Dict[str, Any] The connection details to the SQL server .. !! processed by numpydoc !! .. py:attribute:: sql_query :type: str Sql query to run .. !! processed by numpydoc !! .. py:attribute:: creator_uid :type: str The UID of the creator of this dataclass on the system .. !! processed by numpydoc !! .. py:attribute:: created_at :type: str When this dataclass was created on the system .. !! processed by numpydoc !! .. py:attribute:: project_name :type: str The project name .. py:attribute:: workgroup_name :type: str The workgroup name .. py:attribute:: creator_name :type: str The creator name .. py:method:: wait_for_completion(timeout_seconds: int = 500, poll_frequency: int = 10, print_progress: bool = True) Wait for the asynchronous SQL query to complete :Parameters: **timeout_seconds: int = 500** How many seconds to wait before timing out **poll_frequency: int = 10** How frequent to check the status, in seconds **print_progress: bool = True** Whether to print how long has elapsed since the start of the wait :Returns: result: SQLQuery Dataclasses representing the results of the run .. seealso:: :obj:`rhino_health.lib.endpoints.sql_query.sql_query_dataclass.SQLQuery` Response object .. !! processed by numpydoc !!