Skip to content

Commit 58e541c

Browse files
committed
back port the fix for #24 to 0.2.6
1 parent c4a74f4 commit 58e541c

File tree

6 files changed

+38
-15
lines changed

6 files changed

+38
-15
lines changed

CHANGELOG.rst

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
Change log
22
================================================================================
33

4+
0.26 - 21.12.2016
5+
--------------------------------------------------------------------------------
6+
7+
Updated
8+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
9+
10+
#. `#24 <https://github.com/pyexcel/pyexcel-io/issues/24>`__, pass on batch_size
11+
12+
413
0.25 - 20.12.2016
514
--------------------------------------------------------------------------------
615

@@ -25,17 +34,19 @@ Updated
2534
Added
2635
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2736

28-
#. `#21 <https://github.com/pyexcel/pyexcel-io/issues/21>`__, choose subset from data base tables for export
29-
#. `#22 <https://github.com/pyexcel/pyexcel-io/issues/22>`__, custom renderer if given `row_renderer` as parameter.
37+
#. `#21 <https://github.com/pyexcel/pyexcel-io/issues/21>`__, choose subset from
38+
data base tables for export
39+
#. `#22 <https://github.com/pyexcel/pyexcel-io/issues/22>`__, custom renderer if
40+
given `row_renderer` as parameter.
3041

3142
0.22 - 31.08.2016
3243
--------------------------------------------------------------------------------
3344

3445
Added
3546
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3647

37-
#. support pagination. two pairs: start_row, row_limit and start_column, column_limit
38-
help you deal with large files.
48+
#. support pagination. two pairs: start_row, row_limit and start_column,
49+
column_limit help you deal with large files.
3950
#. `skip_empty_rows=True` was introduced. To include empty rows, put it to False.
4051

4152
Updated
@@ -52,15 +63,21 @@ Updated
5263
Added
5364
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5465

55-
#. csv format: handle utf-16 encoded csv files. Potentially being able to decode other formats if correct "encoding" is provided
56-
#. csv format: write utf-16 encoded files. Potentially other encoding is also supported
66+
#. csv format: handle utf-16 encoded csv files. Potentially being able to decode
67+
other formats if correct "encoding" is provided
68+
#. csv format: write utf-16 encoded files. Potentially other encoding is also
69+
supported
5770
#. support stdin as input stream and stdout as output stream
5871

5972
Updated
6073
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6174

62-
#. Attention, user of pyexcel-io! No longer io stream validation is performed in python 3. The guideline is: io.StringIO for csv, tsv only, otherwise BytesIO for xlsx, xls, ods. You can use RWManager.get_io to produce a correct stream type for you.
63-
#. `#15 <https://github.com/pyexcel/pyexcel-io/issues/15>`__, support foreign django/sql foreign key
75+
#. Attention, user of pyexcel-io! No longer io stream validation is performed
76+
in python 3. The guideline is: io.StringIO for csv, tsv only, otherwise
77+
BytesIO for xlsx, xls, ods. You can use RWManager.get_io to produce a correct
78+
stream type for you.
79+
#. `#15 <https://github.com/pyexcel/pyexcel-io/issues/15>`__, support foreign
80+
django/sql foreign key
6481

6582
0.2.0 - 01.06.2016
6683
--------------------------------------------------------------------------------

docs/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
project = u'pyexcel-io'
1919
copyright = u'2015-2016 Onni Software Ltd.'
20-
version = '0.2.4'
21-
release = '0.2.5'
20+
version = '0.2.5'
21+
release = '0.2.6'
2222
exclude_patterns = []
2323
pygments_style = 'sphinx'
2424
html_theme = 'default'

pyexcel_io.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
overrides: "pyexcel.yaml"
22
name: "pyexcel-io"
33
nick_name: io
4-
version: 0.2.5
5-
release: 0.2.4
4+
version: 0.2.6
5+
release: 0.2.5
66
dependencies:
77
- ordereddict;python_version<"2.7"
88
extra_dependencies:

pyexcel_io/database/django.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,15 @@ class DjangoBookWriter(BookWriter):
218218

219219
def open_content(self, file_content, **keywords):
220220
self.importer = file_content
221+
self.keywords = keywords
221222

222223
def create_sheet(self, sheet_name):
223224
sheet_writer = None
224225
model = self.importer.get(sheet_name)
225226
if model:
226-
sheet_writer = DjangoModelWriterNew(model)
227+
sheet_writer = DjangoModelWriterNew(
228+
model,
229+
batch_size=self.keywords.get('batch_size', None))
227230
return sheet_writer
228231

229232

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
NAME = 'pyexcel-io'
1212
AUTHOR = 'C.W.'
13-
VERSION = '0.2.5'
13+
VERSION = '0.2.6'
1414
EMAIL = 'wangc_2011 (at) hotmail.com'
1515
LICENSE = 'New BSD'
1616
DESCRIPTION = (

tests/test_django_book.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ def setUp(self):
263263
{'B': 6, 'A': 3, 'C': 9}]
264264

265265
def test_save_to_more_models(self):
266+
sample_batch_size = 10
266267
model1 = FakeDjangoModel()
267268
model2 = FakeDjangoModel()
268269
importer = DjangoModelImporter()
@@ -277,11 +278,13 @@ def test_save_to_more_models(self):
277278
adapter2.get_name(): self.content['Sheet2'][1:]
278279
}
279280
writer = DjangoBookWriter()
280-
writer.open_content(importer)
281+
writer.open_content(importer, batch_size=sample_batch_size)
281282
writer.write(to_store)
282283
writer.close()
283284
assert model1.objects.objs == self.result1
284285
assert model2.objects.objs == self.result2
286+
assert model1.objects.batch_size == sample_batch_size
287+
assert model2.objects.batch_size == sample_batch_size
285288

286289
def test_reading_from_more_models(self):
287290
model1 = FakeDjangoModel()

0 commit comments

Comments
 (0)