Say you open up a new database connection on your API with torndb
db_conn = torndb.Connection(ip,
database,
user=user,
password=password,
time_zone="UTC",
charset="utf8")
Is it possible to, after the initial declaration in the code, edit the connections timezone to something else or is it required to spawn a new connection with your updated timezone.
I've tried accessing the torndb.Connection object with db_conn.time_zone
but I run into AttributeError: 'Connection' object has no attribute 'time_zone'
.
You can't directly change the timezone of the connection object afaik. What you can do though, is run a query whenever you need to change the timezone such as SET time_zone = "foo/bar";
and execute it, and for as long as the connection session exists you can dynamically change timezones this way.