"""
@generated by mypy-protobuf.  Do not edit manually!
isort:skip_file
"""

import builtins
import dbtlabs.proto.public.v1.events.fusion.phase.phase_pb2
import google.protobuf.descriptor
import google.protobuf.internal.enum_type_wrapper
import google.protobuf.message
import sys
import typing

if sys.version_info >= (3, 10):
    import typing as typing_extensions
else:
    import typing_extensions

DESCRIPTOR: google.protobuf.descriptor.FileDescriptor

class _QueryOutcome:
    ValueType = typing.NewType("ValueType", builtins.int)
    V: typing_extensions.TypeAlias = ValueType

class _QueryOutcomeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_QueryOutcome.ValueType], builtins.type):
    DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
    QUERY_OUTCOME_UNSPECIFIED: _QueryOutcome.ValueType  # 0
    """Default value. Should only be set on unfinished spans"""
    QUERY_OUTCOME_SUCCESS: _QueryOutcome.ValueType  # 1
    """Successfully executed the query."""
    QUERY_OUTCOME_ERROR: _QueryOutcome.ValueType  # 2
    """Failed with an error type (individual errors reported as separate events).
    If set, `node_error_type` with also be set to indicate the type of error.
    """
    QUERY_OUTCOME_CANCELED: _QueryOutcome.ValueType  # 3
    """Query was canceled (e.g. user-initiated cancellation)."""

class QueryOutcome(_QueryOutcome, metaclass=_QueryOutcomeEnumTypeWrapper):
    """Outcome of a query execution"""

QUERY_OUTCOME_UNSPECIFIED: QueryOutcome.ValueType  # 0
"""Default value. Should only be set on unfinished spans"""
QUERY_OUTCOME_SUCCESS: QueryOutcome.ValueType  # 1
"""Successfully executed the query."""
QUERY_OUTCOME_ERROR: QueryOutcome.ValueType  # 2
"""Failed with an error type (individual errors reported as separate events).
If set, `node_error_type` with also be set to indicate the type of error.
"""
QUERY_OUTCOME_CANCELED: QueryOutcome.ValueType  # 3
"""Query was canceled (e.g. user-initiated cancellation)."""
Global___QueryOutcome: typing_extensions.TypeAlias = QueryOutcome

@typing.final
class QueryExecuted(google.protobuf.message.Message):
    DESCRIPTOR: google.protobuf.descriptor.Descriptor

    SQL_FIELD_NUMBER: builtins.int
    SQL_HASH_FIELD_NUMBER: builtins.int
    ADAPTER_TYPE_FIELD_NUMBER: builtins.int
    QUERY_DESCRIPTION_FIELD_NUMBER: builtins.int
    QUERY_ID_FIELD_NUMBER: builtins.int
    UNIQUE_ID_FIELD_NUMBER: builtins.int
    QUERY_OUTCOME_FIELD_NUMBER: builtins.int
    PHASE_FIELD_NUMBER: builtins.int
    QUERY_ERROR_ADAPTER_MESSAGE_FIELD_NUMBER: builtins.int
    QUERY_ERROR_VENDOR_CODE_FIELD_NUMBER: builtins.int
    DBT_CORE_EVENT_CODE_FIELD_NUMBER: builtins.int
    sql: builtins.str
    """Raw SQL string that was executed. May be obfuscated."""
    sql_hash: builtins.str
    """Blake3, 16-bytes hash of the raw SQL string encoded as hex."""
    adapter_type: builtins.str
    """Type of the adapter (e.g. "snowflake", "bigquery", "postgres", etc.)"""
    query_description: builtins.str
    """Optional human-readable description of the query."""
    query_id: builtins.str
    """Database provided query ID for the executed query, if available."""
    unique_id: builtins.str
    """unique_id of the node that generated this query. Some queries may not be associated with a single node."""
    query_outcome: Global___QueryOutcome.ValueType
    """Outcome for this query execution."""
    phase: dbtlabs.proto.public.v1.events.fusion.phase.phase_pb2.ExecutionPhase.ValueType
    """Execution phase during which this query was evaluated, if available"""
    query_error_adapter_message: builtins.str
    """Granular error information for failed queries.

    Arbitrary adapter defined error message
    """
    query_error_vendor_code: builtins.int
    """Arbitrary adapter (vendor) defined error code"""
    dbt_core_event_code: builtins.str
    """Legacy dbt core event code: E016 or E017"""
    def __init__(
        self,
        *,
        sql: builtins.str = ...,
        sql_hash: builtins.str = ...,
        adapter_type: builtins.str = ...,
        query_description: builtins.str | None = ...,
        query_id: builtins.str | None = ...,
        unique_id: builtins.str | None = ...,
        query_outcome: Global___QueryOutcome.ValueType = ...,
        phase: dbtlabs.proto.public.v1.events.fusion.phase.phase_pb2.ExecutionPhase.ValueType | None = ...,
        query_error_adapter_message: builtins.str | None = ...,
        query_error_vendor_code: builtins.int | None = ...,
        dbt_core_event_code: builtins.str = ...,
    ) -> None: ...
    def HasField(self, field_name: typing.Literal["_phase", b"_phase", "_query_description", b"_query_description", "_query_error_adapter_message", b"_query_error_adapter_message", "_query_error_vendor_code", b"_query_error_vendor_code", "_query_id", b"_query_id", "_unique_id", b"_unique_id", "phase", b"phase", "query_description", b"query_description", "query_error_adapter_message", b"query_error_adapter_message", "query_error_vendor_code", b"query_error_vendor_code", "query_id", b"query_id", "unique_id", b"unique_id"]) -> builtins.bool: ...
    def ClearField(self, field_name: typing.Literal["_phase", b"_phase", "_query_description", b"_query_description", "_query_error_adapter_message", b"_query_error_adapter_message", "_query_error_vendor_code", b"_query_error_vendor_code", "_query_id", b"_query_id", "_unique_id", b"_unique_id", "adapter_type", b"adapter_type", "dbt_core_event_code", b"dbt_core_event_code", "phase", b"phase", "query_description", b"query_description", "query_error_adapter_message", b"query_error_adapter_message", "query_error_vendor_code", b"query_error_vendor_code", "query_id", b"query_id", "query_outcome", b"query_outcome", "sql", b"sql", "sql_hash", b"sql_hash", "unique_id", b"unique_id"]) -> None: ...
    @typing.overload
    def WhichOneof(self, oneof_group: typing.Literal["_phase", b"_phase"]) -> typing.Literal["phase"] | None: ...
    @typing.overload
    def WhichOneof(self, oneof_group: typing.Literal["_query_description", b"_query_description"]) -> typing.Literal["query_description"] | None: ...
    @typing.overload
    def WhichOneof(self, oneof_group: typing.Literal["_query_error_adapter_message", b"_query_error_adapter_message"]) -> typing.Literal["query_error_adapter_message"] | None: ...
    @typing.overload
    def WhichOneof(self, oneof_group: typing.Literal["_query_error_vendor_code", b"_query_error_vendor_code"]) -> typing.Literal["query_error_vendor_code"] | None: ...
    @typing.overload
    def WhichOneof(self, oneof_group: typing.Literal["_query_id", b"_query_id"]) -> typing.Literal["query_id"] | None: ...
    @typing.overload
    def WhichOneof(self, oneof_group: typing.Literal["_unique_id", b"_unique_id"]) -> typing.Literal["unique_id"] | None: ...

Global___QueryExecuted: typing_extensions.TypeAlias = QueryExecuted
