Skip to content

Commit 348194e

Browse files
committed
update documentation
1 parent d95b700 commit 348194e

File tree

2 files changed

+77
-43
lines changed

2 files changed

+77
-43
lines changed

.moban.d/docs/source/index.rst.jj2

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ The parameter **file** is coded in the html form::
3232

3333
.. warning::
3434
If 'field_name' was not specified, for example `request.get_array('file')`
35-
in upload_file() function, your browser would display "Bad Request: The
35+
in upload_file() function, your browser would display "Bad Request: The
3636
browser (or proxy) sent a request that this server could not understand."
3737

3838
The latter simply throws back a csv file whenever a http request is made to
@@ -45,7 +45,7 @@ http response. If you would like to give 'tsvz' a go, please change "csv" to
4545

4646
More excel file formats
4747
--------------------------------------------------------------------------------
48-
48+
4949
The example application understands csv, tsv and its zipped variants: csvz and
5050
tsvz. If you would like to expand the list of supported excel file formats
5151
(see :ref:`file-format-list`) for your own application, you could include one
@@ -75,7 +75,7 @@ Now let's add the following imports first::
7575

7676
Now configure the database connection. Sqllite will be used and **tmp.db** will
7777
be used and can be found in your current working directory::
78-
78+
7979
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///tmp.db'
8080
db = SQLAlchemy(app)
8181

@@ -124,19 +124,23 @@ Then visit http://localhost:5000/custom_export to download the data
124124
{%endblock%}
125125

126126
{%block api_table%}
127-
=========================== ======================================================= ==================================================
128-
data structure from file to data structures from data structures to response
129-
=========================== ======================================================= ==================================================
130-
dict :meth:`~flask_excel.ExcelRequest.get_dict` :meth:`~flask_excel.make_response_from_dict`
131-
records :meth:`~flask_excel.ExcelRequest.get_records` :meth:`~flask_excel.make_response_from_records`
132-
a list of lists :meth:`~flask_excel.ExcelRequest.get_array` :meth:`~flask_excel.make_response_from_array`
133-
dict of a list of lists :meth:`~flask_excel.ExcelRequest.get_book_dict` :meth:`~flask_excel.make_response_from_book_dict`
134-
:class:`pyexcel.Sheet` :meth:`~flask_excel.ExcelRequest.get_sheet` :meth:`~flask_excel.make_response`
135-
:class:`pyexcel.Book` :meth:`~flask_excel.ExcelRequest.get_book` :meth:`~flask_excel.make_response`
136-
database table :meth:`~flask_excel.ExcelRequest.save_to_database` :meth:`~flask_excel.make_response_from_a_table`
137-
a list of database tables :meth:`~flask_excel.ExcelRequest.save_book_to_database` :meth:`~flask_excel.make_response_from_tables`
138-
a database query sets :meth:`~flask_excel.make_response_from_query_sets`
139-
=========================== ======================================================= ==================================================
127+
=========================== ======================================================== ==================================================
128+
data structure from file to data structures from data structures to response
129+
=========================== ======================================================== ==================================================
130+
dict :meth:`~flask_excel.ExcelRequest.get_dict` :meth:`~flask_excel.make_response_from_dict`
131+
records :meth:`~flask_excel.ExcelRequest.get_records` :meth:`~flask_excel.make_response_from_records`
132+
a list of lists :meth:`~flask_excel.ExcelRequest.get_array` :meth:`~flask_excel.make_response_from_array`
133+
dict of a list of lists :meth:`~flask_excel.ExcelRequest.get_book_dict` :meth:`~flask_excel.make_response_from_book_dict`
134+
:class:`pyexcel.Sheet` :meth:`~flask_excel.ExcelRequest.get_sheet` :meth:`~flask_excel.make_response`
135+
:class:`pyexcel.Book` :meth:`~flask_excel.ExcelRequest.get_book` :meth:`~flask_excel.make_response`
136+
database table :meth:`~flask_excel.ExcelRequest.save_to_database` :meth:`~flask_excel.make_response_from_a_table`
137+
:meth:`~flask_excel.ExcelRequest.isave_to_database`
138+
a list of database tables :meth:`~flask_excel.ExcelRequest.save_book_to_database` :meth:`~flask_excel.make_response_from_tables`
139+
:meth:`~flask_excel.ExcelRequest.isave_book_to_database`
140+
a database query sets :meth:`~flask_excel.make_response_from_query_sets`
141+
a generator for records :meth:`~django_excel.ExcelMixin.iget_records`
142+
a generator of lists :meth:`~django_excel.ExcelMixin.iget_array`
143+
=========================== ======================================================== ==================================================
140144
{%endblock%}
141145

142146
{%block api_doc %}
@@ -157,7 +161,7 @@ ExcelRequest
157161
:returns: A sheet object
158162

159163
The following html form, the *field_name* should be "file"::
160-
164+
161165
<!doctype html>
162166
<title>Upload an excel file</title>
163167
<h1>Excel file upload (csv, tsv, csvz, tsvz only)</h1>
@@ -203,12 +207,19 @@ ExcelRequest
203207
.. method:: save_to_database(field_name=None, session=None, table=None, initializer=None, mapdict=None **keywords)
204208

205209
:param field_name: same as :meth:`~flask_excel.ExcelRequest.get_sheet`
206-
:param session: a SQLAlchemy session
207-
:param table: a database table
210+
:param session: a SQLAlchemy session
211+
:param table: a database table
208212
:param initializer: a custom table initialization function if you have one
209213
:param mapdict: the explicit table column names if your excel data do not have the exact column names
210214
:param keywords: additional keywords to :meth:`pyexcel.Sheet.save_to_database`
211215

216+
.. method:: isave_to_database(field_name=None, session=None, table=None, initializer=None, mapdict=None **keywords)
217+
218+
similar to :meth:`:meth:`~flask_excel.ExcelRequest.isave_to_database`. But it requires
219+
less memory.
220+
221+
This requires column names must be at the first row.
222+
212223
.. method:: save_book_to_database(field_name=None, session=None, tables=None, initializers=None, mapdicts=None, **keywords)
213224

214225
:param field_name: same as :meth:`~flask_excel.ExcelRequest.get_sheet`
@@ -218,6 +229,12 @@ ExcelRequest
218229
:param mapdicts: a list of explicit table column names if your excel data sheets do not have the exact column names
219230
:param keywords: additional keywords to :meth:`pyexcel.Book.save_to_database`
220231

232+
.. method:: isave_book_to_database(field_name=None, session=None, tables=None, initializers=None, mapdicts=None, **keywords)
233+
234+
similar to :meth:`:meth:`~flask_excel.ExcelRequest.isave_book_to_database`. But it requires
235+
less memory.
236+
237+
This requires column names must be at the first row in each sheets
221238

222239
Response methods
223240
**********************
@@ -228,7 +245,7 @@ Response methods
228245

229246
:param pyexcel_instance: :class:`pyexcel.Sheet` or :class:`pyexcel.Book`
230247
:param file_type: one of the following strings:
231-
248+
232249
* 'csv'
233250
* 'tsv'
234251
* 'csvz'
@@ -237,7 +254,7 @@ Response methods
237254
* 'xlsx'
238255
* 'xlsm'
239256
* 'ods'
240-
257+
241258
:param status: unless a different status is to be returned.
242259
:param file_name: provide a custom file name for the response, excluding the file extension
243260

@@ -294,7 +311,7 @@ Response methods
294311
Produce a multiple sheet Excel book of *file_type*. It becomes the same
295312
as :meth:`~flask_excel.make_response_from_a_table` if you pass *tables*
296313
with an array that has a single table
297-
314+
298315
:param session: SQLAlchemy session
299316
:param tables: SQLAlchemy tables
300317
:param file_type: same as :meth:`~flask_excel.make_response`

docs/source/index.rst

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ The parameter **file** is coded in the html form::
181181

182182
.. warning::
183183
If 'field_name' was not specified, for example `request.get_array('file')`
184-
in upload_file() function, your browser would display "Bad Request: The
184+
in upload_file() function, your browser would display "Bad Request: The
185185
browser (or proxy) sent a request that this server could not understand."
186186

187187
The latter simply throws back a csv file whenever a http request is made to
@@ -244,7 +244,7 @@ Now let's add the following imports first::
244244

245245
Now configure the database connection. Sqllite will be used and **tmp.db** will
246246
be used and can be found in your current working directory::
247-
247+
248248
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///tmp.db'
249249
db = SQLAlchemy(app)
250250

@@ -297,19 +297,23 @@ All supported data types
297297

298298
The example application likes to have array but it is not just about arrays. Here is table of functions for all supported data types:
299299

300-
=========================== ======================================================= ==================================================
301-
data structure from file to data structures from data structures to response
302-
=========================== ======================================================= ==================================================
303-
dict :meth:`~flask_excel.ExcelRequest.get_dict` :meth:`~flask_excel.make_response_from_dict`
304-
records :meth:`~flask_excel.ExcelRequest.get_records` :meth:`~flask_excel.make_response_from_records`
305-
a list of lists :meth:`~flask_excel.ExcelRequest.get_array` :meth:`~flask_excel.make_response_from_array`
306-
dict of a list of lists :meth:`~flask_excel.ExcelRequest.get_book_dict` :meth:`~flask_excel.make_response_from_book_dict`
307-
:class:`pyexcel.Sheet` :meth:`~flask_excel.ExcelRequest.get_sheet` :meth:`~flask_excel.make_response`
308-
:class:`pyexcel.Book` :meth:`~flask_excel.ExcelRequest.get_book` :meth:`~flask_excel.make_response`
309-
database table :meth:`~flask_excel.ExcelRequest.save_to_database` :meth:`~flask_excel.make_response_from_a_table`
310-
a list of database tables :meth:`~flask_excel.ExcelRequest.save_book_to_database` :meth:`~flask_excel.make_response_from_tables`
311-
a database query sets :meth:`~flask_excel.make_response_from_query_sets`
312-
=========================== ======================================================= ==================================================
300+
=========================== ======================================================== ==================================================
301+
data structure from file to data structures from data structures to response
302+
=========================== ======================================================== ==================================================
303+
dict :meth:`~flask_excel.ExcelRequest.get_dict` :meth:`~flask_excel.make_response_from_dict`
304+
records :meth:`~flask_excel.ExcelRequest.get_records` :meth:`~flask_excel.make_response_from_records`
305+
a list of lists :meth:`~flask_excel.ExcelRequest.get_array` :meth:`~flask_excel.make_response_from_array`
306+
dict of a list of lists :meth:`~flask_excel.ExcelRequest.get_book_dict` :meth:`~flask_excel.make_response_from_book_dict`
307+
:class:`pyexcel.Sheet` :meth:`~flask_excel.ExcelRequest.get_sheet` :meth:`~flask_excel.make_response`
308+
:class:`pyexcel.Book` :meth:`~flask_excel.ExcelRequest.get_book` :meth:`~flask_excel.make_response`
309+
database table :meth:`~flask_excel.ExcelRequest.save_to_database` :meth:`~flask_excel.make_response_from_a_table`
310+
:meth:`~flask_excel.ExcelRequest.isave_to_database`
311+
a list of database tables :meth:`~flask_excel.ExcelRequest.save_book_to_database` :meth:`~flask_excel.make_response_from_tables`
312+
:meth:`~flask_excel.ExcelRequest.isave_book_to_database`
313+
a database query sets :meth:`~flask_excel.make_response_from_query_sets`
314+
a generator for records :meth:`~django_excel.ExcelMixin.iget_records`
315+
a generator of lists :meth:`~django_excel.ExcelMixin.iget_array`
316+
=========================== ======================================================== ==================================================
313317

314318
See more examples of the data structures in :ref:`pyexcel documentation<pyexcel:a-list-of-data-structures>`
315319

@@ -333,7 +337,7 @@ ExcelRequest
333337
:returns: A sheet object
334338

335339
The following html form, the *field_name* should be "file"::
336-
340+
337341
<!doctype html>
338342
<title>Upload an excel file</title>
339343
<h1>Excel file upload (csv, tsv, csvz, tsvz only)</h1>
@@ -379,12 +383,19 @@ ExcelRequest
379383
.. method:: save_to_database(field_name=None, session=None, table=None, initializer=None, mapdict=None **keywords)
380384

381385
:param field_name: same as :meth:`~flask_excel.ExcelRequest.get_sheet`
382-
:param session: a SQLAlchemy session
383-
:param table: a database table
386+
:param session: a SQLAlchemy session
387+
:param table: a database table
384388
:param initializer: a custom table initialization function if you have one
385389
:param mapdict: the explicit table column names if your excel data do not have the exact column names
386390
:param keywords: additional keywords to :meth:`pyexcel.Sheet.save_to_database`
387391

392+
.. method:: isave_to_database(field_name=None, session=None, table=None, initializer=None, mapdict=None **keywords)
393+
394+
similar to :meth:`:meth:`~flask_excel.ExcelRequest.isave_to_database`. But it requires
395+
less memory.
396+
397+
This requires column names must be at the first row.
398+
388399
.. method:: save_book_to_database(field_name=None, session=None, tables=None, initializers=None, mapdicts=None, **keywords)
389400

390401
:param field_name: same as :meth:`~flask_excel.ExcelRequest.get_sheet`
@@ -394,6 +405,12 @@ ExcelRequest
394405
:param mapdicts: a list of explicit table column names if your excel data sheets do not have the exact column names
395406
:param keywords: additional keywords to :meth:`pyexcel.Book.save_to_database`
396407

408+
.. method:: isave_book_to_database(field_name=None, session=None, tables=None, initializers=None, mapdicts=None, **keywords)
409+
410+
similar to :meth:`:meth:`~flask_excel.ExcelRequest.isave_book_to_database`. But it requires
411+
less memory.
412+
413+
This requires column names must be at the first row in each sheets
397414

398415
Response methods
399416
**********************
@@ -404,7 +421,7 @@ Response methods
404421

405422
:param pyexcel_instance: :class:`pyexcel.Sheet` or :class:`pyexcel.Book`
406423
:param file_type: one of the following strings:
407-
424+
408425
* 'csv'
409426
* 'tsv'
410427
* 'csvz'
@@ -413,7 +430,7 @@ Response methods
413430
* 'xlsx'
414431
* 'xlsm'
415432
* 'ods'
416-
433+
417434
:param status: unless a different status is to be returned.
418435
:param file_name: provide a custom file name for the response, excluding the file extension
419436

@@ -470,7 +487,7 @@ Response methods
470487
Produce a multiple sheet Excel book of *file_type*. It becomes the same
471488
as :meth:`~flask_excel.make_response_from_a_table` if you pass *tables*
472489
with an array that has a single table
473-
490+
474491
:param session: SQLAlchemy session
475492
:param tables: SQLAlchemy tables
476493
:param file_type: same as :meth:`~flask_excel.make_response`

0 commit comments

Comments
 (0)