# 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_sql_stats_response = opsi_client.ingest_sql_stats(
    ingest_sql_stats_details=oci.opsi.models.IngestSqlStatsDetails(
        items=[
            oci.opsi.models.SqlStats(
                sql_identifier="EXAMPLE-sqlIdentifier-Value",
                plan_hash_value=331,
                time_collected=datetime.strptime(
                    "2028-01-20T00:21:38.274Z",
                    "%Y-%m-%dT%H:%M:%S.%fZ"),
                instance_name="EXAMPLE-instanceName-Value",
                last_active_time="EXAMPLE-lastActiveTime-Value",
                parse_calls=407,
                disk_reads=758,
                direct_reads=480,
                direct_writes=890,
                buffer_gets=330,
                rows_processed=234,
                serializable_aborts=551,
                fetches=387,
                executions=505,
                avoided_executions=820,
                end_of_fetch_count=267,
                loads=494,
                version_count=801,
                invalidations=472,
                obsolete_count=749,
                px_servers_executions=853,
                cpu_time_in_us=528,
                elapsed_time_in_us=953,
                avg_hard_parse_time_in_us=739,
                concurrency_wait_time_in_us=809,
                application_wait_time_in_us=33,
                cluster_wait_time_in_us=724,
                user_io_wait_time_in_us=694,
                plsql_exec_time_in_us=68,
                java_exec_time_in_us=612,
                sorts=646,
                sharable_mem=938,
                total_sharable_mem=52,
                type_check_mem=403,
                io_cell_offload_eligible_bytes=10,
                io_interconnect_bytes=757,
                physical_read_requests=313,
                physical_read_bytes=364,
                physical_write_requests=673,
                physical_write_bytes=335,
                exact_matching_signature="EXAMPLE-exactMatchingSignature-Value",
                force_matching_signature="EXAMPLE-forceMatchingSignature-Value",
                io_cell_uncompressed_bytes=414,
                io_cell_offload_returned_bytes=250,
                child_number=93,
                command_type=352,
                users_opening=825,
                users_executing=777,
                optimizer_cost=645,
                full_plan_hash_value="EXAMPLE-fullPlanHashValue-Value",
                module="EXAMPLE-module-Value",
                service="EXAMPLE-service-Value",
                action="EXAMPLE-action-Value",
                sql_profile="EXAMPLE-sqlProfile-Value",
                sql_patch="EXAMPLE-sqlPatch-Value",
                sql_plan_baseline="EXAMPLE-sqlPlanBaseline-Value",
                delta_execution_count=854,
                delta_cpu_time=738,
                delta_io_bytes=766,
                delta_cpu_rank=889,
                delta_execs_rank=764,
                sharable_mem_rank=153,
                delta_io_rank=150,
                harmonic_sum=402,
                wt_harmonic_sum=998,
                total_sql_count=250)]),
    database_id="ocid1.test.oc1..<unique_ID>EXAMPLE-databaseId-Value",
    id="ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value",
    opc_request_id="LABSZ4LT3MR8QBI3IQRZ<unique_ID>",
    if_match="EXAMPLE-ifMatch-Value",
    opc_retry_token="EXAMPLE-opcRetryToken-Value")

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