Skip to main content

Easy query generation for the FTrack API.

Project description


Easy query generation for the FTrack API. The official module is very powerful and well designed, but the custom SQL is not very pythonic to use, and dynamically generating queries can be difficult. This was created as an object orientated approach to building queries, using inspiration from the design of SQLAlchemy.

This class expands upon ftrack_api.Session.

Example Usage

with FTrackQuery() as session:
    Task = session.Task

    note = session.Note.create(
        content='My new note',
    task = Task.where(Task.parent==session.Episode.first(), name='My Task').first()

Equivalent examples from the API reference:

Note: If an entity type is used multiple times, it's recommended to use <Entity> = session.<Entity> after the session is initialised. To save space below, that part has been omitted.

# projects = session.query('Project')
# for project in projects:
#     print project['name']
projects = Project
for project in projects:
    print project['name']

# session.query('Project').all()

# session.query('Project where status is active')

# session.query('Project where status is active and name like "%thrones"')
Project.where('%thrones'), status='active')

# session.query('Project where status is active and (name like "%thrones" or full_name like "%thrones")')
Project.where(or_('%thrones'),'%thrones')), status='active')

# session.query('Task where is "{0}"'.format(project['id']))

# session.query('Task where is "{0}" and is "Done"'.format(project['id']))
Task.where('Done', project=project)

# session.query('Task where timelogs.start >= "{0}"'.format('day')))

# session.query('Note where author has (first_name is "Jane" and last_name is "Doe")')
Note.where('Jane', User.last_name=='Doe'))

# session.query('User where not timelogs any ()')

# projects = session.query('select full_name, from Project')'full_name', '')

# select name from Project where allocations.resource[Group].memberships any (user.username is "john_doe")'name').where(Project.allocations.resource(Group).memberships.any(Project.user.username=='john_doe'))

Project details

Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for ftrack-query, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size ftrack-query-1.0.0.tar.gz (8.3 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page