[BangPypers] How to convert Datastore data into a CSV file python
HUSSAIN BOHRA
hussainbohra at gmail.com
Tue Jul 29 06:45:38 CEST 2014
I think with datastore, you meant to say 'Google App Engine Datastore'... ?
If this is the case, please read API details available at:
https://developers.google.com/appengine/docs/python/datastore/
This would help you extracting data out of datastore.
Thanks,
On Mon, Jul 28, 2014 at 11:39 PM, Gora Mohanty <gora at mimirtech.com> wrote:
> On 28 July 2014 21:49, VIMAL K <vimal.k at ieee.org> wrote:
> >
> > Hello,
> > i am new to python. I need to write a function which converts a datastore
> > data to csv format, which is downloadable. I researched upon the topic
> over
> > google, got few and less info on it. The code till now is below:
>
>
> What do you mean by "datastore" in this context?
>
> >
> >
> > def calllog_csv(self):
> > from collections import defaultdict
> > date = datetime.strptime('01/01/2014', '%m/%d/%Y')
> > qry = CallLog.query().filter(CallLog.created >= date,
> > CallLog.created <= datetime.now()).fetch()
> > columns = defaultdict(qry)
> > log.debug("query===>" + str(columns))
> > with open('calllog.csv', 'w') as csv_log:
> > reader = csv.DictReader(csv_log)
> > for row in reader:
> > for (k, v) in row.items():
> > columns[k].append(v)
> > log.debug("columns== from==>" + str(columns['from']))
> > return columns
> >
> > Tell me where i am wrong, or am i right? any suggestions would be
> helpfull.
> > Thank you all in advance
>
>
> Would you be kind enough to explain how this code snippet relates to
> the description
> of what you wanted the code to do? It seems to be cut-and-pasted from
> somewhere
> else, and I cannot see how it is relevant. What in the world is "CallLog"?
>
> Regards,
> Gora
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> https://mail.python.org/mailman/listinfo/bangpypers
>
--
Hussain Bohra
Tavant Technologies
More information about the BangPypers
mailing list