jaydebeapi
jaydebeapi copied to clipboard
Driver time conversion
I am using jaydebeapi to extract data from sqlworkbenchj, and was hoping to figure out if there is a way to toggle time zone conversions. I am trying to work with data in UTC, although jaydebeapi is returning data that is in EST - as compared with Prestodb, for example, which keeps time in UTC.
@baztian , @leedsrising I have found that setting JVM arg -Duser.timezone=UTC
allows me to get data back in UTC.
From what I can tell jaydebeapi does not currently support the JAVA_OPTS
environment variable nor provide a way to pass in specific JVM args.
@baztian Can this be added?
Thank you.
@leedsrising I did find an alternative. You can take a look at how jaydebeapi starts the JVM and then just start it yourself passing in whatever args you need (e.g. -Duser.timezone=UTC
). That's worked for me so far.
I had the same problem. I edited _jdbc_connect_jpype
function and fixed it. See the last line
def _jdbc_connect_jpype(jclassname, url, driver_args, jars, libs):
import jpype
if not jpype.isJVMStarted():
args = []
class_path = []
if jars:
class_path.extend(jars)
class_path.extend(_get_classpath())
if class_path:
args.append('-Djava.class.path=%s' %
os.path.pathsep.join(class_path))
if libs:
# path to shared libraries
libs_path = os.path.pathsep.join(libs)
args.append('-Djava.library.path=%s' % libs_path)
args.append('-Duser.timezone=GMT') # ADD THIS LINE TO CODE