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.

confusing error if wrong extension

See original GitHub issue

ploomber infers the type of task with a combination of the source and product extension, but if there’s a typo a confusing error shows. example, if the user wants to dump data:

  
  - source: another.sql 
    product: another.parquets # typo here

error:

ploomber.exceptions.SourceInitializationError: Error initializing SQLScriptSource('SELECT *\nFROM nu...ams"], "param") ]]') Loaded from: /Users/Edu/Desktop/sql/another.sql: The {{product}} placeholder is required. Example: 'CREATE TABLE {{product}} AS (SELECT * FROM ...)'

Fix: see if the value in product has something similar to a .parquet or .csv extension and show an error

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
edublancascommented, Mar 22, 2022

right. the debug is not supported in SQL tasks.

As a recommendation for testing and debugging your implementation, add one test case here, you can use existing tasks as reference for building yours.

Essentially, you want to create a pipeline where one of the products has a wrong extension, then validate that the appropriate error is raised.

As a first step, write some sample test and ensure you get the original error:

ploomber.exceptions.SourceInitializationError: Error initializing SQLScriptSource('SELECT *\nFROM nu...ams"], "param") ]]') Loaded from: /Users/Edu/Desktop/sql/another.sql: The {{product}} placeholder is required. Example: 'CREATE TABLE {{product}} AS (SELECT * FROM ...)'

Then, take it from there and test your implementation, ensure you have your dev environment correctly configured: https://github.com/ploomber/ploomber/blob/master/CONTRIBUTING.md

Then work on the implementation until the test passes, you can run individual tests like this:

pytest path/to/test_file.py::test_name

I’ll add a few comments to the PR

1reaction
edublancascommented, Mar 20, 2022

@neelasha23 as a pointer, you can use this to compute string distance to see if the user had a typo (e.g. parque instead of parquet)

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] Confusing error message about unknown extension ...
I roughly got this error when trying to push the extension to an organization that didn't have an app that supported Checkout Extensions....
Read more >
A file is in a different format than its extension indicates in Excel
An issue with a file name extension might occur when a workbook that you are trying to open is unreadable and the contents...
Read more >
C# compiler fails with misleading error when calling generic ...
When you create extension method for List<T> it can not be called for List<int> without telling method what is T . That's why...
Read more >
Extension class giving error as Method does not exist or ...
I have written extension class for a page. Class is giving. error as "Error: Compile Error: Method does not exist or incorrect signature: ......
Read more >
Inconsistent/wrong file type error messages in web uploader
The web uploader thinks that any file with MIME type image/* is acceptable, but that is not actually true and it's causing some...
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