Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Dalet 5.1e - Get Titles in Class
import sys
import pypyodbc
import json
import io
import time
SybaseConnectionString = 'DSN=DSN_NAME;UID=USERNAME;Pwd=PASSWORD;'
dbConn = pypyodbc.connect(SybaseConnectionString)
cur = dbConn.cursor()
def Dalet51_getTitlesInClass(classId):
classSearchQuery = '''SELECT titles.title_id, titles.title, soundfiles.soundfile_name, dab_rds.value
FROM titles_in_class, titles, soundfiles, dab_rds
WHERE titles_in_class.class_id = ?
AND titles_in_class.title_id = titles.title_id
AND titles.soundfile_id = soundfiles.soundfile_id
AND titles.title_id *= dab_rds.title_id
AND dab_rds.dabrds_no = 2
ORDER BY titles.title_id DESC'''
cur.execute(classSearchQuery, [classId])
titles = dict()
count = 0;
for d in cur:
titles[count] = dict()
titles[count]['title_id'] = d[0]
titles[count]['title'] = d[1]
titles[count]['soundfile'] = d[2]
titles[count]['outputName'] = d[3]
count = count + 1
return titles
if __name__ == "__main__":
print Dalet51_getTitlesInClass(1124)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment