Skip to main content

Write to multiple databases and formats easily from python

Project description

Description

This project is useful in any scenario where you need to write some data in a readable manner quickly and easily.

It can be used to write to:

  • csv

  • sqlite

  • mysql

  • redis

  • mongo

  • postgres

  • aerospike

Look at https://pypi.python.org/pypi/data-readers/ to write to them. This library was written with the intention to be useful without data-readers but they work very well together.

Setup

Install

pip install data-writers

Usage

Import DataWriter

from datawriters.datawriter import DataWriter

Create a list of dictionaries for your data:

data = [{“column1”:”row1-item1”, “column2”:”row1-item2”}, {“column1”:”row2-item1”, “column2”:”row2-item2”}, {“column1”:”row3-item1”, “column2”:”row3-item2”}]

csv

DataWriter(writer=’csv’, database=’data.csv’).save(data)

sqlite

DataWriter(writer=’sqlite’, database=’data.sqlite’, table=’DataTable’).save(data)

mysql

DataWriter(writer=’mysql’, database=’data’, user=’root’, table=’DataTable’).save(data)

redis

DataWriter(writer=’redis’, database=’1’).save(data)

mongo

DataWriter(writer=’mongo’, database=’data’, table=’DataTable’).save(data)

postgres

DataWriter(writer=’postgres’, database=’data’, table=’DataTable’).save(data)

aerospike

DataWriter(writer=’aerospike’, namespace=’data’, set=’DataTable’).save(data)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

data-writers-0.5.3.zip (14.8 kB view details)

Uploaded Source

File details

Details for the file data-writers-0.5.3.zip.

File metadata

  • Download URL: data-writers-0.5.3.zip
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for data-writers-0.5.3.zip
Algorithm Hash digest
SHA256 b47cdb098e0af90094ba26b62e337e832f308e153ef65788e9d49e071307ffb2
MD5 5243bf7c14b67ec172f7d1ba02b63119
BLAKE2b-256 54f6944d70767c2e584b39169717b5df0cc44663f9ed2ac4f37264164615fbbd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page