Skip to content

Commit

Permalink
Updating README description for validate_schema
Browse files Browse the repository at this point in the history
  • Loading branch information
kunaljubce committed Mar 29, 2024
1 parent a353a69 commit 85cc47a
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,29 @@ quinn.validate_presence_of_columns(source_df, ["name", "age", "fun"])

**validate_schema()**

Raises an exception unless `source_df` contains all the `StructFields` defined in the `required_schema`.
Raises an exception unless `source_df` contains all the `StructFields` defined in the `required_schema`. By default, `ignore_nullable` is set to False, so exception
will be raised even if column names and data types are matching but nullability conditions are mismatching.

```python
quinn.validate_schema(source_df, required_schema)
quinn.validate_schema(required_schema, _df=source_df)
```

You can also set `ignore_nullable` to True, so the validation will happen only on column names and data types, not on nullability.

```python
quinn.validate_schema(required_schema, ignore_nullable=True, _df=source_df)
```

> [!TIP]
> This function can also be used as a decorator to other functions that return a dataframe. This can help validate the schema of the returned df.
>
> ```python
> @quinn.validate_schema(required_schema, ignore_nullable=True)
> def get_df():
return df
> ```
**validate_absence_of_columns()**
Raises an exception if `source_df` contains `age` or `cool` columns.
Expand Down

0 comments on commit 85cc47a

Please sign in to comment.