# This is an automatically generated code sample.
# To make this code sample work in your Oracle Cloud tenancy,
# please replace the values for any parameters whose current values do not fit
# your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and
# boolean, number, and enum parameters with values not fitting your use case).

import oci
from datetime import datetime

# Create a default config using DEFAULT profile in default location
# Refer to
# https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File
# for more info
config = oci.config.from_file()


# Initialize service client with default config file
opsi_client = oci.opsi.OperationsInsightsClient(config)


# Send the request to service, some parameters are not required, see API
# doc for more info
ingest_my_sql_sql_stats_response = opsi_client.ingest_my_sql_sql_stats(
    ingest_my_sql_sql_stats_details=oci.opsi.models.IngestMySqlSqlStatsDetails(
        items=[
            oci.opsi.models.MySqlSqlStats(
                digest="EXAMPLE-digest-Value",
                time_collected=datetime.strptime(
                    "2032-05-26T08:35:52.374Z",
                    "%Y-%m-%dT%H:%M:%S.%fZ"),
                command_type="EXAMPLE-commandType-Value",
                total_rows=121,
                perf_schema_used_percent=50,
                schema_name="EXAMPLE-schemaName-Value",
                exec_count=250,
                total_latency_in_ps=986,
                lock_latency_in_ps=305,
                err_count=276,
                warn_count=773,
                rows_affected=782,
                rows_sent=351,
                rows_examined=175,
                tmp_disk_tables=545,
                tmp_tables=614,
                select_full_join=309,
                select_full_range_join=276,
                select_range=293,
                select_range_check=726,
                select_scan=581,
                sort_merge_passes=198,
                sort_range=220,
                rows_sorted=312,
                sort_scan=920,
                no_index_used_count=669,
                no_good_index_used_count=233,
                cpu_latency_in_ps=293,
                max_controlled_memory_in_bytes=905,
                max_total_memory_in_bytes=438,
                exec_count_secondary=757,
                time_first_seen=datetime.strptime(
                    "2042-11-13T17:46:38.173Z",
                    "%Y-%m-%dT%H:%M:%S.%fZ"),
                time_last_seen=datetime.strptime(
                    "2019-02-23T22:49:49.483Z",
                    "%Y-%m-%dT%H:%M:%S.%fZ"))]),
    database_id="ocid1.test.oc1..<unique_ID>EXAMPLE-databaseId-Value",
    id="ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value",
    opc_request_id="5KKBMKGNBEDGYP60YIA0<unique_ID>",
    if_match="EXAMPLE-ifMatch-Value",
    opc_retry_token="EXAMPLE-opcRetryToken-Value")

# Get the data from response
print(ingest_my_sql_sql_stats_response.data)

Was this article helpful?