@@ -1386,6 +1386,23 @@ cdef class AuthMessage(Message):
13861386 # use of AES encryption
13871387 self .encoded_jdwp_data = encrypted_jdwp_data.hex().upper() + " 01"
13881388
1389+ cdef str _get_alter_timezone_statement(self ):
1390+ """
1391+ Returns the statement required to change the session time zone to match
1392+ the time zone in use by the Python interpreter.
1393+ """
1394+ cdef:
1395+ int tz_hour, tz_minute, timezone
1396+ str sign, tz_repr
1397+ timezone = - time.altzone if time.daylight else - time.timezone
1398+ tz_hour = timezone // 3600
1399+ tz_minute = (timezone - (tz_hour * 3600 )) // 60
1400+ if tz_hour < 0 :
1401+ sign = " -"
1402+ tz_hour = - tz_hour
1403+ tz_repr = f" {sign}{tz_hour:02}:{tz_minute:02}"
1404+ return f" ALTER SESSION SET TIME_ZONE= ' {tz_repr}' \x00 "
1405+
13891406 cdef tuple _get_version_tuple(self , ReadBuffer buf):
13901407 """
13911408 Return the 5-tuple for the database version. Note that the format
@@ -1528,7 +1545,7 @@ cdef class AuthMessage(Message):
15281545 self ._encrypt_passwords()
15291546 num_pairs = 2
15301547 else :
1531- num_pairs = 3
1548+ num_pairs = 4
15321549
15331550 # token authentication
15341551 if self .token is not None :
@@ -1610,6 +1627,8 @@ cdef class AuthMessage(Message):
16101627 driver_name)
16111628 self ._write_key_value(buf, " SESSION_CLIENT_VERSION" ,
16121629 str (_connect_constants.full_version_num))
1630+ self ._write_key_value(buf, " AUTH_ALTER_SESSION" ,
1631+ self ._get_alter_timezone_statement(), 1 )
16131632 if self .conn_impl._cclass is not None :
16141633 self ._write_key_value(buf, " AUTH_KPPL_CONN_CLASS" ,
16151634 self .conn_impl._cclass)
0 commit comments