# 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(
"2000-04-28T02:57:52.833Z",
"%Y-%m-%dT%H:%M:%S.%fZ"),
command_type="EXAMPLE-commandType-Value",
total_rows=78,
perf_schema_used_percent=441,
schema_name="EXAMPLE-schemaName-Value",
exec_count=524,
total_latency_in_ps=212,
lock_latency_in_ps=565,
err_count=391,
warn_count=614,
rows_affected=407,
rows_sent=815,
rows_examined=839,
tmp_disk_tables=689,
tmp_tables=719,
select_full_join=346,
select_full_range_join=810,
select_range=851,
select_range_check=21,
select_scan=917,
sort_merge_passes=527,
sort_range=354,
rows_sorted=768,
sort_scan=746,
no_index_used_count=305,
no_good_index_used_count=999,
cpu_latency_in_ps=968,
max_controlled_memory_in_bytes=76,
max_total_memory_in_bytes=450,
exec_count_secondary=468,
time_first_seen=datetime.strptime(
"2026-03-08T21:59:02.073Z",
"%Y-%m-%dT%H:%M:%S.%fZ"),
time_last_seen=datetime.strptime(
"2018-06-16T14:47:12.194Z",
"%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="YWMHX9GGLHLCQEERSMSG<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)