question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

convert() and fieldmap() swallow errors silently by default

See original GitHub issue

This has led to a lot of difficult-to-debug scenarios in my experience. As you’re developing an ETL pipeline, you’re often iterating on your conversion functions quickly, which often leads to exceptions being raised. Currently petl eats those errors silently, making it far more difficult to navigate this process. In the regular operation of an ETL pipeline, it’s also undesirable for new, unexpected errors to pass silently.

The current workaround is to set failonerror=True in every call to fieldmap() and the like. I suggest you make failonerror=True be the default. This might be something that would require bumping to version 2.0 since it will likely cause a lot of exceptions to be raised that were previously ignored (for better or for worse!).

Issue Analytics

  • State:open
  • Created 8 years ago
  • Reactions:1
  • Comments:22 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
alimanfoocommented, Aug 6, 2019

Apologies, I closed this issue too hastily. Personally I’d be happy to change the default to failonerror=True but that would need a major version bump. I need to make a quick release for a downstream project, and so was taking the opportunity to merge in some PRs, but didn’t want to introduce any changes that might surprise people.

How about we do a quick release 1.3 which includes the new petl.config.failonerror config option, set to False by default (current behaviour). Then follow up with a 2.0 release shortly after which switches the default to True, but precede that with a message on the mailing list to see if anyone has any objections to the change.

1reaction
bmaggardcommented, Jan 10, 2017

If failonerror=False, petl doesn’t eat errors silently, it returns ‘errorvalue’. So, how about also adding a ‘returnexceptions’ option, akin to:

In [1]: import petl as etl

In [2]: t1 = etl.wrap([ ['foo'], ['A'], [1] ]).convert('foo', 'lower', errorvalue=Exception)

In [3]: t1
Out[3]:
+---------------------+
| foo                 |
+=====================+
| 'a'                 |
+---------------------+
| <class 'Exception'> |
+---------------------+

… but to have the original exceptions returned instead? This would enable categorizing failures directly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Usage - transforming rows and columns - petl - Read the Docs
By default, the fields for the output table will be determined as the union of ... Similar to petl.transform.basics.cat() except that no attempt...
Read more >
How can we push errors into an error field of sys_...
I have written few validations in a transform map script, which will ignore the row if condition doesn't matches.As there are many scenarios...
Read more >
bids.layout.layout — PyBIDS 0.15.5 documentation
This sets a default for the instance, but can be overridden in individual .get() requests. database_path : str Optional path to directory containing...
Read more >
What's new — fmriprep version documentation
Additionally, this includes a fix to allow SyN distortion correction in combination with the --ignore fieldmaps option. MAINT: Add pre-commit , dev installation ......
Read more >
Change History - CyberTracker Wiki
Parse error when too looking at the map and there are too many fields; ESRI plugin fixed ... Client: Add EXP() and POW()...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found