Data rarely stays in one place. It might start in a transactional database, get copied into a data lake, pass through a processing pipeline, and end up in a warehouse, with CSV exports and Parquet files along the way. If a validation tool only understood one of these, you would have to move data just to check it. Pointblank works with data where it already is, and the same validation methods work whether the data is a Polars DataFrame in memory, a table in PostgreSQL, or a set of Parquet files.
This works because what you write is separate from how it runs. You write col_vals_gt(columns="amount", value=0) once, and Pointblank turns that into whatever each backend needs, running Polars operations for a DataFrame or generating SQL for a database. This chapter goes through the backends Pointblank supports and what to keep in mind for each. The in-memory and DuckDB examples use the built-in datasets and run as written. The remote database examples show connection code that you would adapt to your own systems.
19.1 Two kinds of backend
Pointblank can validate two kinds of data sources. The first is DataFrames from Polars and Pandas, which hold data in memory. The second is database tables reached through Ibis, a Python library that can talk to DuckDB, PostgreSQL, MySQL, SQLite, and cloud warehouses like Snowflake and BigQuery, without pulling the data out of the database. In general, if Ibis can connect to a backend, Pointblank can validate it.
The validation methods are the same for all of them, which is what makes plans portable. To see this, we can run the same check on the same data loaded two ways, as a Polars DataFrame and as a DuckDB table.
Both report the same 74 failing rows. Polars computed the first result in memory, and DuckDB computed the second by running SQL that Pointblank generated. This means you can develop a plan locally against a sample and then run the same plan against a production database without changing it.
19.2 In-memory DataFrames
For data that fits in memory, a DataFrame is the simplest source. You pass it to Validate and add your checks, and Pointblank works out whether it is a Polars or Pandas DataFrame. Here is a small Polars frame with a negative amount and a missing customer ID.
Each check fails on one row: the negative amount in the first step and the missing customer ID in the second. Polars is fast and uses all your CPU cores, which makes it a good default for local work and for large datasets that still fit in memory.
Pandas works the same way. Converting the frame to Pandas and running the same checks gives the same result.
Pandas has two quirks worth knowing about. The first is that it can represent missing data in several ways: Python’s None, NumPy’s nan, and Pandas’ own NA. Pointblank treats all of them as null, so a completeness check catches every form. Here is a column with all three plus one real value.
Three of the four rows fail, the ones holding None, nan, and NA, so all three forms are recognized as null.
The second quirk is that a Pandas column can hold a mix of types, such as integers and strings together. Polars does not allow this. A numeric comparison on a mixed column can raise an error instead of giving pass and fail results.
mixed_types = pd.DataFrame({"x": [1, 2, "oops", 4]})try: pb.Validate(data=mixed_types).col_vals_gt(columns="x", value=0).interrogate()exceptExceptionas e:print(f"{type(e).__name__}: comparison failed on a mixed-type column")
UFuncTypeError: comparison failed on a mixed-type column
The comparison raises a NumPy UFuncTypeError, because you cannot compare the string "oops" with a number. This is different from a validation failure, since the check could not run at all. If validation behaves strangely on a Pandas DataFrame, check the column’s dtype first. Converting the column to a single type, or reading the source file with stricter type settings, fixes the problem.
19.3 Databases and query pushdown
19.4 Ibis table expressions
You do not have to validate a table exactly as it is stored. With an Ibis table expression, you can filter, join, or add columns first and then validate the result, and Pointblank sends the whole thing to the database as one query. To validate only the in-app purchases in game_revenue, filter before checking.
The check runs on the 447 in-app purchase rows rather than the whole table, because the filter is part of the query the database runs. You can validate a filtered subset, a recent slice, or the result of a join this way without saving it anywhere first.
19.5 Validating files
19.6 Choosing a backend
The right backend depends on where the data already is and how big it is. For data that fits in memory, Polars is fast, and Pandas makes sense if your workflow already uses it. For data larger than memory that you do not want to put on a server, DuckDB can query files and database files directly. When the data lives in PostgreSQL, MySQL, or a cloud warehouse, validate it there, where query pushdown handles large tables and nothing has to be moved. Since the validation methods are the same everywhere, you can start with whatever you already have and switch later without rewriting your checks.
19.7 Backend differences to watch
The validation methods are the same across backends, but the backends themselves are not, and a few differences can catch you out. Type systems vary, so an integer in Polars, a NumPy integer in Pandas, and an integer column in a database may behave slightly differently in edge cases involving precision or type conversion. Null handling also differs. In SQL, comparing anything with NULL gives NULL rather than true or false, while DataFrame libraries have their own rules. Pointblank smooths over these differences where it can, but complex expressions can still expose them. Regular expressions vary the most. Polars uses Rust’s regex engine, Pandas uses Python’s, and each database has its own dialect, so a col_vals_regex() pattern that works on one backend may need changes for another. In every case, the safeguard is the same: test your plan against a sample from the backend you will actually use.