File: has_nulls.py

package info (click to toggle)
python-agate 1.9.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,996 kB
  • sloc: python: 8,512; makefile: 126
file content (19 lines) | stat: -rw-r--r-- 485 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from agate.aggregations.base import Aggregation
from agate.data_types import Boolean


class HasNulls(Aggregation):
    """
    Check if the column contains null values.

    :param column_name:
        The name of the column to check.
    """
    def __init__(self, column_name):
        self._column_name = column_name

    def get_aggregate_data_type(self, table):
        return Boolean()

    def run(self, table):
        return None in table.columns[self._column_name].values()