Skip to content

Commit 5491395

Browse files
committed
revert Uint64->Int64
1 parent 5654512 commit 5491395

File tree

2 files changed

+7
-19
lines changed

2 files changed

+7
-19
lines changed

examples/basic_example_v2/basic_example.py

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,6 @@ def callee(session):
136136
with session.transaction().execute(
137137
"""
138138
PRAGMA TablePathPrefix("{}");
139-
140-
DECLARE $seriesId AS Uint64;
141-
DECLARE $seasonId AS Uint64;
142-
DECLARE $episodeId AS Uint64;
143-
DECLARE $title AS Utf8;
144-
145139
UPSERT INTO episodes (series_id, season_id, episode_id, title) VALUES (2, 6, 1, "TBD");
146140
""".format(
147141
path
@@ -157,11 +151,6 @@ def select_with_parameters(pool, path, series_id, season_id, episode_id):
157151
def callee(session):
158152
query = """
159153
PRAGMA TablePathPrefix("{}");
160-
161-
DECLARE $seriesId AS Uint64;
162-
DECLARE $seasonId AS Uint64;
163-
DECLARE $episodeId AS Uint64;
164-
165154
$format = DateTime::Format("%Y-%m-%d");
166155
SELECT
167156
title,
@@ -175,7 +164,7 @@ def callee(session):
175164
with session.transaction(ydb.QuerySerializableReadWrite()).execute(
176165
query,
177166
{
178-
"$seriesId": series_id, # could be defined implicit in case of int, str, bool
167+
"$seriesId": (series_id, ydb.PrimitiveType.Uint64),
179168
"$seasonId": (season_id, ydb.PrimitiveType.Uint64), # could be defined via tuple
180169
"$episodeId": ydb.TypedValue(
181170
episode_id, ydb.PrimitiveType.Uint64
@@ -201,11 +190,6 @@ def explicit_tcl(pool, path, series_id, season_id, episode_id):
201190
def callee(session):
202191
query = """
203192
PRAGMA TablePathPrefix("{}");
204-
205-
DECLARE $seriesId AS Uint64;
206-
DECLARE $seasonId AS Uint64;
207-
DECLARE $episodeId AS Uint64;
208-
209193
UPDATE episodes
210194
SET air_date = CAST(CurrentUtcDate() AS Uint64)
211195
WHERE series_id = $seriesId AND season_id = $seasonId AND episode_id = $episodeId;
@@ -220,7 +204,11 @@ def callee(session):
220204
# Transaction control settings continues active transaction (tx)
221205
with tx.execute(
222206
query,
223-
{"$seriesId": series_id, "$seasonId": season_id, "$episodeId": episode_id},
207+
{
208+
"$seriesId": (series_id, ydb.PrimitiveType.Uint64),
209+
"$seasonId": (season_id, ydb.PrimitiveType.Uint64),
210+
"$episodeId": (episode_id, ydb.PrimitiveType.Uint64),
211+
},
224212
) as _:
225213
pass
226214

ydb/convert.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ def query_parameters_to_pb(parameters):
303303

304304

305305
_from_python_type_map = {
306-
int: types.PrimitiveType.Uint64,
306+
int: types.PrimitiveType.Int64,
307307
float: types.PrimitiveType.Float,
308308
bool: types.PrimitiveType.Bool,
309309
str: types.PrimitiveType.Utf8,

0 commit comments

Comments
 (0)