How to use the pathvalidate.validate_sqlite_attr_name function in pathvalidate

To help you get started, we’ve selected a few pathvalidate examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github thombashi / pathvalidate / test / test_sqlite.py View on Github external
def test_exception_invalid_win_char(self, value):
        with pytest.raises(InvalidCharError):
            validate_sqlite_attr_name(value)
github thombashi / pathvalidate / test / test_sqlite.py View on Github external
def test_exception_reserved_valid(self, value, expected):
        with pytest.raises(expected):
            validate_sqlite_attr_name(value)
github thombashi / pathvalidate / test / test_sqlite.py View on Github external
def test_normal_ascii(self, value):
        validate_sqlite_attr_name(value)
github thombashi / pathvalidate / test / test_sqlite.py View on Github external
def test_normal_utf8(self, value):
        validate_sqlite_attr_name(value)
github thombashi / pathvalidate / test / test_sqlite.py View on Github external
def test_normal_non_alphabet_first_char(self, value):
        validate_sqlite_attr_name(value)
github thombashi / pathvalidate / test / test_sqlite.py View on Github external
def test_exception_type(self, value, expected):
        with pytest.raises(expected):
            validate_sqlite_attr_name(value)
github thombashi / pytablereader / pytablereader / _tabledata_sanitizer.py View on Github external
def _validate_header(self, header):
        try:
            pv.validate_sqlite_attr_name(header)
        except (pv.NullNameError, pv.ReservedNameError):
            pass
        except pv.InvalidCharError as e:
            raise InvalidHeaderNameError(e)
github thombashi / SimpleSQLite / simplesqlite / loader / data.py View on Github external
def __sanitize_header_list(self):
        new_header_list = []

        for i, header in enumerate(self.header_list):
            try:
                pathvalidate.validate_sqlite_attr_name(header)
                new_header = header
            except pathvalidate.ReservedNameError as e:
                rename_count = 0
                while True:
                    new_header = "{:s}_rename{:d}".format(header, rename_count)
                    if all([
                        new_header not in self.header_list[i:],
                        new_header not in new_header_list,
                    ]):
                        break

                    rename_count += 1

            new_header_list.append(new_header)

        self.__header_list = new_header_list