mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-23 01:14:31 +02:00
Removed convert skip_false and --skip-false, closes #542
This commit is contained in:
parent
fafa966300
commit
96fab69256
8 changed files with 12 additions and 26 deletions
|
|
@ -2952,7 +2952,6 @@ def _generate_convert_help():
|
|||
type=click.Choice(["integer", "float", "blob", "text"]),
|
||||
)
|
||||
@click.option("--drop", is_flag=True, help="Drop original column afterwards")
|
||||
@click.option("--no-skip-false", is_flag=True, help="Don't skip falsey values")
|
||||
@click.option("-s", "--silent", is_flag=True, help="Don't show a progress bar")
|
||||
@click.option("pdb_", "--pdb", is_flag=True, help="Open pdb debugger on first error")
|
||||
def convert(
|
||||
|
|
@ -2968,7 +2967,6 @@ def convert(
|
|||
output,
|
||||
output_type,
|
||||
drop,
|
||||
no_skip_false,
|
||||
silent,
|
||||
pdb_,
|
||||
):
|
||||
|
|
@ -3045,7 +3043,6 @@ def convert(
|
|||
output=output,
|
||||
output_type=output_type,
|
||||
drop=drop,
|
||||
skip_false=not no_skip_false,
|
||||
multi=multi,
|
||||
show_progress=not silent,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -2909,7 +2909,6 @@ class Table(Queryable):
|
|||
where: Optional[str] = None,
|
||||
where_args: Optional[Union[Iterable, dict]] = None,
|
||||
show_progress: bool = False,
|
||||
skip_false: bool = True,
|
||||
):
|
||||
"""
|
||||
Apply conversion function ``fn`` to every value in the specified columns.
|
||||
|
|
@ -2952,8 +2951,6 @@ class Table(Queryable):
|
|||
|
||||
def convert_value(v):
|
||||
bar.update(1)
|
||||
if skip_false and not v:
|
||||
return v
|
||||
return jsonify_if_needed(fn(v))
|
||||
|
||||
fn_name = fn.__name__
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ def parsedate(value, dayfirst=False, yearfirst=False, errors=None):
|
|||
- errors=r.IGNORE to ignore values that cannot be parsed
|
||||
- errors=r.SET_NULL to set values that cannot be parsed to null
|
||||
"""
|
||||
if not value:
|
||||
return value
|
||||
try:
|
||||
return (
|
||||
parser.parse(value, dayfirst=dayfirst, yearfirst=yearfirst)
|
||||
|
|
@ -38,6 +40,8 @@ def parsedatetime(value, dayfirst=False, yearfirst=False, errors=None):
|
|||
- errors=r.IGNORE to ignore values that cannot be parsed
|
||||
- errors=r.SET_NULL to set values that cannot be parsed to null
|
||||
"""
|
||||
if not value:
|
||||
return value
|
||||
try:
|
||||
return parser.parse(value, dayfirst=dayfirst, yearfirst=yearfirst).isoformat()
|
||||
except parser.ParserError:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue