@@ -96,10 +96,11 @@ def select_simple(pool, path):
96
96
result_sets = pool .execute_with_retries (
97
97
"""
98
98
PRAGMA TablePathPrefix("{}");
99
+ $format = DateTime::Format("%Y-%m-%d");
99
100
SELECT
100
101
series_id,
101
102
title,
102
- release_date
103
+ $format(DateTime::FromSeconds(CAST(DateTime::ToSeconds(DateTime::IntervalFromDays(CAST(release_date AS Int16))) AS Uint32))) AS release_date
103
104
FROM series
104
105
WHERE series_id = 1;
105
106
""" .format (
@@ -142,9 +143,10 @@ def select_with_parameters(pool, path, series_id, season_id, episode_id):
142
143
def callee (session ):
143
144
query = """
144
145
PRAGMA TablePathPrefix("{}");
146
+ $format = DateTime::Format("%Y-%m-%d");
145
147
SELECT
146
148
title,
147
- air_date
149
+ $format(DateTime::FromSeconds(CAST(DateTime::ToSeconds(DateTime::IntervalFromDays(CAST(air_date AS Int16))) AS Uint32))) AS air_date
148
150
FROM episodes
149
151
WHERE series_id = $seriesId AND season_id = $seasonId AND episode_id = $episodeId;
150
152
""" .format (
@@ -156,9 +158,7 @@ def callee(session):
156
158
{
157
159
"$seriesId" : series_id , # could be defined implicit
158
160
"$seasonId" : (season_id , ydb .PrimitiveType .Int64 ), # could be defined via tuple
159
- "$episodeId" : ydb .TypedValue (
160
- episode_id , ydb .PrimitiveType .Int64
161
- ), # could be defined via special class
161
+ "$episodeId" : ydb .TypedValue (episode_id , ydb .PrimitiveType .Int64 ), # could be defined via special class
162
162
},
163
163
commit_tx = True ,
164
164
) as result_sets :
@@ -293,7 +293,7 @@ def run(endpoint, database, path):
293
293
with ydb .Driver (
294
294
endpoint = endpoint ,
295
295
database = database ,
296
- credentials = ydb .credentials_from_env_variables ()
296
+ credentials = ydb .credentials_from_env_variables (),
297
297
) as driver :
298
298
driver .wait (timeout = 5 , fail_fast = True )
299
299
0 commit comments