Quickstart
Last updated
Last updated
This page gives you all the information you need to get started validating your CSVs with CsvPath. It is super high-level and quick. You will want to go deeper on other pages later. We're going to do a trivial validation of a CSV file. Validating an Excel file would be essentially the same.
Feel like skipping the Python? 🎥 or .
is available through as csvpath
. The project is quite active. You should pin the version you use but update it regularly.
We use Poetry for our own development. If you choose Poetry, all you need to do is:
If you prefer Pip, install CsvPath Framework with:
Have a look at the for more details. You can read that site in parallel to this one.
The worker class in CsvPath is unsurprisingly called CsvPath
. For simple validation, it is all you need.
For more complex situations and DataOps automation we use the manager class CsvPaths
. But we'll come back to that in later pages. For now just know that it exists, has essentially the same API, and is equally lightweight to use.
To continue with the simplest possible Python, let's do a hello world.
Create a script file and import CsvPath:
Create a test CSV file. Save it as trivial.csv or whatever name you like.
Make a csvpath. Also a trivial one, just to keep it simple.
This path says:
Open trivial.csv
Scan all the lines
Match every one of them
Here's everything:
What does this script do?
Line 1: imports CsvPath so we can use it
Line 3: is our csvpath that we'll use to validate our test file, trivial.csv
Line 6: fast-forwards though the CSV file's lines. We could also step through them one by one, if we wanted to.
Line 8: checks if we consider the file valid. If the file didn't meet expectations our csvpath would have declared the file invalid using the fail()
function.
When you run your script you should see something like:
Hello-world examples are never super impressive on their own. But you are now ready to dig in and see what CsvPath can really do.
The quickest way to bootstrap a CsvPath Framework project is the command line interface (CLI). The CLI is a super simple tool that is great for fast no-code development. To try the CLI, skip over to .
Next, try . Also check out the for more use cases and examples. If you'd like a helping hand, !