@@ -96,10 +96,11 @@ def select_simple(pool, path):
9696 result_sets = pool .execute_with_retries (
9797 """
9898 PRAGMA TablePathPrefix("{}");
99+ $format = DateTime::Format("%Y-%m-%d");
99100 SELECT
100101 series_id,
101102 title,
102- release_date
103+ $format(DateTime::FromSeconds(CAST(DateTime::ToSeconds(DateTime::IntervalFromDays(CAST(release_date AS Int16))) AS Uint32))) AS release_date
103104 FROM series
104105 WHERE series_id = 1;
105106 """ .format (
@@ -142,9 +143,10 @@ def select_with_parameters(pool, path, series_id, season_id, episode_id):
142143 def callee (session ):
143144 query = """
144145 PRAGMA TablePathPrefix("{}");
146+ $format = DateTime::Format("%Y-%m-%d");
145147 SELECT
146148 title,
147- air_date
149+ $format(DateTime::FromSeconds(CAST(DateTime::ToSeconds(DateTime::IntervalFromDays(CAST(air_date AS Int16))) AS Uint32))) AS air_date
148150 FROM episodes
149151 WHERE series_id = $seriesId AND season_id = $seasonId AND episode_id = $episodeId;
150152 """ .format (
@@ -156,9 +158,7 @@ def callee(session):
156158 {
157159 "$seriesId" : series_id , # could be defined implicit
158160 "$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
162162 },
163163 commit_tx = True ,
164164 ) as result_sets :
@@ -293,7 +293,7 @@ def run(endpoint, database, path):
293293 with ydb .Driver (
294294 endpoint = endpoint ,
295295 database = database ,
296- credentials = ydb .credentials_from_env_variables ()
296+ credentials = ydb .credentials_from_env_variables (),
297297 ) as driver :
298298 driver .wait (timeout = 5 , fail_fast = True )
299299
0 commit comments