Hi Steve, i did not mean to download all table, i just want to download the
csv file stored in PerformanceFile.
db.define_table( 'Pass_Configuration', Field('PassID',
'reference Pass', label=T('Pass'),
requires=IS_NOT_EMPTY()),
Field('TargetID',
'reference Target', label=T('Target')),
Field(ASSET_CONFIGURATION_ID,
'reference %s' %ASSET_CONFIGURATION, label=T('%s'
%ASSET_CONFIGURATION)),
Field('PerformanceFile',
type = 'upload', label=T('Performance File')),
Field('PerformanceJSON',
type = 'text', writable=False,readable=False, label=T('Performance
JSON')), redefine=True)
On Wed, May 29, 2019 at 3:26 PM 黄祥 <[email protected]> wrote:
> for download all tables at once
> try:
> import StringIO
> except ImportError:
> from io import StringIO
>
> def download_csv():
> stream = StringIO.StringIO()
> db.export_to_csv_file(stream,
> delimiter = ',',
> quotechar = '"',
> write_colnames = True,
> represent = False)
> response.headers['Content-Type'] = 'text/csv'
> response.headers['Content-Disposition'] = 'inline;
> filename="{0}.csv"'.format(request.function.replace('_', ' ').title() )
> return stream.getvalue()
>
> modified the code before db.export_to_csv_file() to rows select to
> download one table at a time
>
> best regards,
> stifan
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/ef218ee3-8954-4981-9135-2ba19818be58%40googlegroups.com
> <https://groups.google.com/d/msgid/web2py/ef218ee3-8954-4981-9135-2ba19818be58%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/CAKDykLj71MZMWj1%2BxwoG9ugHY-f68DDi8uCF0Qd6gsi%2BgR2Q%3DA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.