# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: requests.proto
# plugin: python-betterproto
from .common_pb import *
from typing import Dict
import betterproto


@dataclass
class CatalogsRequest(betterproto.Message):
    """Request for Meta#getCatalogs()"""

    connection_id: str = betterproto.string_field(1)


@dataclass
class DatabasePropertyRequest(betterproto.Message):
    """Request for Meta#getDatabaseProperties()"""

    connection_id: str = betterproto.string_field(1)


@dataclass
class SchemasRequest(betterproto.Message):
    """
    Request for Meta#getSchemas(String, org.apache.calcite.avatica.Meta.Pat)}
    """

    catalog: str = betterproto.string_field(1)
    schema_pattern: str = betterproto.string_field(2)
    connection_id: str = betterproto.string_field(3)
    has_catalog: bool = betterproto.bool_field(4)
    has_schema_pattern: bool = betterproto.bool_field(5)


@dataclass
class TablesRequest(betterproto.Message):
    """
    Request for Request for Meta#getTables(String,
    org.apache.calcite.avatica.Meta.Pat,   org.apache.calcite.avatica.Meta.Pat,
    java.util.List)
    """

    catalog: str = betterproto.string_field(1)
    schema_pattern: str = betterproto.string_field(2)
    table_name_pattern: str = betterproto.string_field(3)
    type_list: List[str] = betterproto.string_field(4)
    has_type_list: bool = betterproto.bool_field(6)
    connection_id: str = betterproto.string_field(7)
    has_catalog: bool = betterproto.bool_field(8)
    has_schema_pattern: bool = betterproto.bool_field(9)
    has_table_name_pattern: bool = betterproto.bool_field(10)


@dataclass
class TableTypesRequest(betterproto.Message):
    """Request for Meta#getTableTypes()"""

    connection_id: str = betterproto.string_field(1)


@dataclass
class ColumnsRequest(betterproto.Message):
    """
    Request for Meta#getColumns(String, org.apache.calcite.avatica.Meta.Pat,
    org.apache.calcite.avatica.Meta.Pat, org.apache.calcite.avatica.Meta.Pat).
    """

    catalog: str = betterproto.string_field(1)
    schema_pattern: str = betterproto.string_field(2)
    table_name_pattern: str = betterproto.string_field(3)
    column_name_pattern: str = betterproto.string_field(4)
    connection_id: str = betterproto.string_field(5)
    has_catalog: bool = betterproto.bool_field(6)
    has_schema_pattern: bool = betterproto.bool_field(7)
    has_table_name_pattern: bool = betterproto.bool_field(8)
    has_column_name_pattern: bool = betterproto.bool_field(9)


@dataclass
class TypeInfoRequest(betterproto.Message):
    """Request for Meta#getTypeInfo()"""

    connection_id: str = betterproto.string_field(1)


@dataclass
class PrepareAndExecuteRequest(betterproto.Message):
    """
    Request for Meta#prepareAndExecute(Meta.StatementHandle, String, long,
    Meta.PrepareCallback)
    """

    connection_id: str = betterproto.string_field(1)
    sql: str = betterproto.string_field(2)
    max_row_count: int = betterproto.uint64_field(3)
    statement_id: int = betterproto.uint32_field(4)
    max_rows_total: int = betterproto.int64_field(5)
    first_frame_max_size: int = betterproto.int32_field(6)


@dataclass
class PrepareRequest(betterproto.Message):
    """Request for Meta.prepare(Meta.ConnectionHandle, String, long)"""

    connection_id: str = betterproto.string_field(1)
    sql: str = betterproto.string_field(2)
    max_row_count: int = betterproto.uint64_field(3)
    max_rows_total: int = betterproto.int64_field(4)


@dataclass
class FetchRequest(betterproto.Message):
    """Request for Meta#fetch(Meta.StatementHandle, List, long, int)"""

    connection_id: str = betterproto.string_field(1)
    statement_id: int = betterproto.uint32_field(2)
    offset: int = betterproto.uint64_field(3)
    fetch_max_row_count: int = betterproto.uint32_field(4)
    frame_max_size: int = betterproto.int32_field(5)


@dataclass
class CreateStatementRequest(betterproto.Message):
    """Request for Meta#createStatement(Meta.ConnectionHandle)"""

    connection_id: str = betterproto.string_field(1)


@dataclass
class CloseStatementRequest(betterproto.Message):
    """Request for Meta#closeStatement(Meta.StatementHandle)"""

    connection_id: str = betterproto.string_field(1)
    statement_id: int = betterproto.uint32_field(2)


@dataclass
class OpenConnectionRequest(betterproto.Message):
    """
    Request for Meta#openConnection(Meta.ConnectionHandle, Map<String, String>)
    """

    connection_id: str = betterproto.string_field(1)
    info: Dict[str, str] = betterproto.map_field(
        2, betterproto.TYPE_STRING, betterproto.TYPE_STRING
    )


@dataclass
class CloseConnectionRequest(betterproto.Message):
    """Request for Meta#closeConnection(Meta.ConnectionHandle)"""

    connection_id: str = betterproto.string_field(1)


@dataclass
class ConnectionSyncRequest(betterproto.Message):
    connection_id: str = betterproto.string_field(1)
    conn_props: "ConnectionProperties" = betterproto.message_field(2)


@dataclass
class ExecuteRequest(betterproto.Message):
    """Request for Meta#execute(Meta.ConnectionHandle, list, long)"""

    statement_handle: "StatementHandle" = betterproto.message_field(1)
    parameter_values: List["TypedValue"] = betterproto.message_field(2)
    deprecated_first_frame_max_size: int = betterproto.uint64_field(3)
    has_parameter_values: bool = betterproto.bool_field(4)
    first_frame_max_size: int = betterproto.int32_field(5)


@dataclass
class SyncResultsRequest(betterproto.Message):
    connection_id: str = betterproto.string_field(1)
    statement_id: int = betterproto.uint32_field(2)
    state: "QueryState" = betterproto.message_field(3)
    offset: int = betterproto.uint64_field(4)


@dataclass
class CommitRequest(betterproto.Message):
    """Request to invoke a commit on a Connection"""

    connection_id: str = betterproto.string_field(1)


@dataclass
class RollbackRequest(betterproto.Message):
    """Request to invoke rollback on a Connection"""

    connection_id: str = betterproto.string_field(1)


@dataclass
class PrepareAndExecuteBatchRequest(betterproto.Message):
    """Request to prepare and execute a collection of sql statements."""

    connection_id: str = betterproto.string_field(1)
    statement_id: int = betterproto.uint32_field(2)
    sql_commands: List[str] = betterproto.string_field(3)


@dataclass
class UpdateBatch(betterproto.Message):
    """Each command is a list of TypedValues"""

    parameter_values: List["TypedValue"] = betterproto.message_field(1)


@dataclass
class ExecuteBatchRequest(betterproto.Message):
    connection_id: str = betterproto.string_field(1)
    statement_id: int = betterproto.uint32_field(2)
    updates: List["UpdateBatch"] = betterproto.message_field(3)
