Skip to content

Instantly share code, notes, and snippets.

@randyzwitch
Created March 4, 2020 20:17
Show Gist options
  • Save randyzwitch/db0b7b6cb6dd7b4afa2358f19e18686a to your computer and use it in GitHub Desktop.
Save randyzwitch/db0b7b6cb6dd7b4afa2358f19e18686a to your computer and use it in GitHub Desktop.
Get Telemetry Data query example
def get_telemetry_data(sessionuid, lapstarttime, lapendtime, playercarindex, metric):
conn = pymapd.connect(host = host, user = user, password = password, dbname = dbname, port = port)
## get telemetry data
## by specifying the timestamps and sessionuid, it implies a single track
tele = f"""select
packettime,
max({metric}) as {metric}
from gtc_cartelemetry_v2
where sessionuid = '{sessionuid}' and
packettime between '{lapstarttime}' and '{lapendtime}' and
playercarindex = {playercarindex}
group by 1
order by 1
"""
telemetry_ref = pd.read_sql(tele, conn)
return telemetry_ref
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment