8000 0.6.6 - minor update on log by chfw · Pull Request #113 · pyexcel/pyexcel-io · GitHub
[go: up one dir, main page]

Skip to content

0.6.6 - minor update on log #113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jan 29, 2022
Merged
Prev Previous commit
Next Next commit
💚 convert print to log. resolves #112
  • Loading branch information
chfw committed Jan 28, 2022
commit d2cbb5decf6a1035b4157ed1156e97d9f7429e00
6 changes: 6 additions & 0 deletions changelog.yml
< 8000 /tr>
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: pyexcel-io
organisation: pyexcel
releases:
- changes:
- action: updated
details:
- "`#112`: Log "Empty Row Warning" instead 'print' "
version: 0.6.6
date: 31.1.2022
- changes:
- action: updated
details:
Expand Down
6 changes: 3 additions & 3 deletions pyexcel-io.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ project: "pyexcel-io"
name: pyexcel-io
nick_name: io
version: 0.6.5
current_version: 0.6.5
release: 0.6.5
copyright_year: 2015-2020
current_version: 0.6.6
release: 0.6.6
copyright_year: 2015-2022
moban_command: false
is_on_conda: true
dependencies:
Expand Down
2 changes: 1 addition & 1 deletion pyexcel_io/database/importers/django.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(self, importer, adapter, batch_size=None, bulk_save=True):

def write_row(self, array):
if is_empty_array(array):
print(constants.MESSAGE_EMPTY_ARRAY)
log.warning(constants.MESSAGE_EMPTY_ARRAY)
else:
new_array = swap_empty_string_for_none(array)
if self.mapdict:
Expand Down
10 changes: 7 additions & 3 deletions pyexcel_io/database/importers/sqlalchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@
:copyright: (c) 2014-2020 by Onni Software Ltd.
:license: New BSD License, see LICENSE for more details
"""
import logging

import pyexcel_io.constants as constants
from pyexcel_io.utils import is_empty_array, swap_empty_string_for_none
from pyexcel_io.plugin_api import IWriter, ISheetWriter

LOG = logging.getLogger(__name__)


class PyexcelSQLSkipRowException(Exception):
"""
Expand All @@ -35,14 +39,14 @@ def __init__(

def write_row(self, array):
if is_empty_array(array):
print(constants.MESSAGE_EMPTY_ARRAY)
LOG.warning(constants.MESSAGE_EMPTY_ARRAY)
else:
new_array = swap_empty_string_for_none(array)
try:
self._write_row(new_array)
except PyexcelSQLSkipRowException:
print(constants.MESSAGE_IGNORE_ROW)
print(new_array)
LOG.info(constants.MESSAGE_IGNORE_ROW)
LOG.info(new_array)

def _write_row(self, array):
new_array = array
Expand Down
0