@@ -115,4 +115,47 @@ def from_proto(msg: ydb_query_pb2.BeginTransactionResponse) -> "BeginTransaction
115
115
return BeginTransactionResponse (
116
116
status = ServerStatus (msg .status , msg .issues ),
117
117
tx_meta = TransactionMeta .from_proto (msg .tx_meta ),
118
- )
118
+ )
119
+
120
+ @dataclass
121
+ class QueryContent (IFromPublic , IToProto ):
122
+ text : str
123
+ syntax : Optional [str ]
124
+
125
+ @staticmethod
126
+ def from_public (query : str ) -> "QueryContent" :
127
+ return QueryContent (text = query )
128
+
129
+ def to_proto (self ) -> ydb_query_pb2 .QueryContent :
130
+ return ydb_query_pb2 .QueryContent (text = self .text , syntax = self .syntax )
131
+
132
+
133
+ @dataclass
134
+ class TransactionControl (IToProto ):
135
+ begin_tx : Optional [TransactionSettings ]
136
+ commit_tx : Optional [bool ]
137
+ tx_id : Optional [str ]
138
+
139
+ def to_proto (self ) -> ydb_query_pb2 .TransactionControl :
140
+ if self .tx_id :
141
+ return ydb_query_pb2 .TransactionControl (
142
+ tx_id = self .tx_id ,
143
+ commit_tx = self .commit_tx ,
144
+ )
145
+ return ydb_query_pb2 .TransactionControl (
146
+ begin_tx = self .begin_tx ,
147
+ commit_tx = self .commit_tx
148
+ )
149
+
150
+
151
+ @dataclass
152
+ class ExecuteQueryRequest :
153
+ exec_mode : Optional [str ]
154
+ concurrent_result_sets : bool = False
155
+ parameters : Optional [dict ]
156
+ query_content : QueryContent
157
+ session_id : str
158
+ stats_mode : Optional [str ]
159
+ tx_control : TransactionControl
160
+
161
+
0 commit comments