Releases: huntfx/ftrack-query
Releases · huntfx/ftrack-query
Bug fixes and custom exceptions
Change component cleanup method to an option
Changes
- The
clean_components()
method has been moved to.options(remove_components=True)
Fix bug when reusing create statements
Fixes
- Fix bug where reusing create statements would result in duplicate values.
Improved statements
Features
- Add
attr
function to use with comparisons (attr('x.y')
is replacingentity.x.y
) - Add
.options()
method on queries to set the page size or attach a new session - Add
FTRACK_API_PAGE_SIZE
environment variable to set the page size globally, and apage_size
parameter toFTrackQuery()
to set it for the entire session - Add
session.select()
as shorthand forsession.execute(select())
Improvements
.in_()
now supports any data types- Generators are now automatically unpacked when passed to
in_()
- Subqueries will not attempt to remap any values (it was confusing behaviour)
New statement syntax
Features
- Added
select
,update
,delete
andcreate
statements to work in a similar way toSQLAlchemy
. - Rewrote subquery support - subqueries will be used when the API allows for it, otherwise an error will be raised (the old way would automatically execute the query).
Improvements
- Add a
clean_components()
method when building adelete
statement, which will automatically remove matching components from every location. - Stop automatically executing the query when checking for truthiness.
- Allow the use of
order_by
for sorting, and also acceptasc
/desc
as strings. - Added a
contains
method, which is the equivelant of.like(f'%{val}%')
.
Automatically execute query objects in comparisons
Improvements
- Any query objects passed into comparisons will now be executed.
The following is now valid:
session.Episode.where(project=query)
- Executesquery.one()
.
session.Episode.where(entity.project == query)
- Executesquery.one()
.
session.Episode.where(entity.project.in_(query))
- Executesquery.all()
.
session.Episode.where(entity.project.in_(query, query))
- Executesquery.one()
on each.
Improve populate behaviour
Improvements
- Accept lists in populate function -
session.populate(item, (entity.name, entity.project.name))
is now valid
Improvement to primary key query
Fixes
- If the primary key query finds multiple entities with different capitalisation, return the one exactly matching the input
Remove ftrack_api modules as class attributes
Changes
- Remove
FTrackQuery.exc
(ftrack_api.exception
) - Remove
FTrackQuery.symbol
(ftrack_api.symbol
) - Remove
FTrackQuery.Entity
(ftrack_api.entity.base.Entity
)
Minor improvements
Features
- Add
startswith()
andendswith()
operators
Changes
- Added error message if attempting to use
__contains__()
. - Increase number of pre-defined primary keys
Fixes
- Fix error if no arguments are passed to
in_()