Update REGEXP function for sqlite

This commit is contained in:
2023-08-18 15:33:09 +02:00
parent 5d92f909a1
commit af94afaa62
2 changed files with 7 additions and 10 deletions

View File

@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
from __future__ import annotations
from typing import Iterator, Dict, Any, Tuple, TextIO, List
from typing import Iterator, Dict, Any, Tuple, TextIO, List, Optional
import re
import datetime
import csv
@ -13,6 +13,10 @@ RE_STR_START = re.compile(r'.*,"[^"]*$')
RE_STR_END = re.compile(r'^[^"]*",.*')
def sqlite_regexp(pattern: str, value: Optional[str]) -> Optional[bool]:
return re.match(pattern, value) is not None if value is not None else None
def cast_value(value: str) -> Any:
if value == '':
return None