# 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(
"2021-03-19T01:21:24.776Z",
"%Y-%m-%dT%H:%M:%S.%fZ"),
command_type="EXAMPLE-commandType-Value",
total_rows=512,
perf_schema_used_percent=999,
schema_name="EXAMPLE-schemaName-Value",
exec_count=341,
total_latency_in_ps=324,
lock_latency_in_ps=51,
err_count=780,
warn_count=70,
rows_affected=789,
rows_sent=965,
rows_examined=823,
tmp_disk_tables=286,
tmp_tables=339,
select_full_join=570,
select_full_range_join=800,
select_range=847,
select_range_check=89,
select_scan=206,
sort_merge_passes=505,
sort_range=251,
rows_sorted=395,
sort_scan=417,
no_index_used_count=153,
no_good_index_used_count=968,
cpu_latency_in_ps=621,
max_controlled_memory_in_bytes=696,
max_total_memory_in_bytes=944,
exec_count_secondary=123,
time_first_seen=datetime.strptime(
"2049-05-22T16:20:20.585Z",
"%Y-%m-%dT%H:%M:%S.%fZ"),
time_last_seen=datetime.strptime(
"2016-02-20T07:17:16.989Z",
"%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="RDX4L1HMH9FHAKQU6FXM<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)