Closed mesozoic closed 7 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 99.95%. Comparing base (
b676bf0
) to head (be844ec
).:exclamation: Current head be844ec differs from pull request most recent head 2744c67. Consider uploading reports for the commit 2744c67 to get more accurate results
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
This is a breaking change to the
pyairtable.formulas
module, so it would have to be released as 3.0, but it introduces a more thorough way for library users to construct formulas and chain them together.This module allows for complex nested expressions that are built up through chaining; for example:
The way all of the functions are exposed is a bit janky, and relies on code generation running against a text file that must be refreshed whenever Airtable releases new functions. I'll look to incorporate the approach laid out in #328 for reading those from the formula playground instead.
A summary of changes:
formula=
kwargs now accept eitherstr
or an instance ofFormula
Formula
class has subclassesComparison
andFunctionCall
match()
function signature remains the same, though it returns aFormula
class instead ofstr
to_airtable_value()
is removed, and replaced with a similar (but not same)to_formula_str()
field_name()
replaces theFIELD()
functionEQ
,NE
,GT
,GTE
,LT
,LTE
replace equivalent functions (EQUAL()
, etc.)AND()
andOR()
now returnComparison
(a subclass ofFormula
) instead ofstr
FunctionCall
(a subclass ofFormula
).eq()
, etc. convenience methods for producing formulas.Resolves #304 Resolves #305 Resolves #324 Resolves #328