Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

Writes pandas DataFrame to several flavors of sql database

Project description

sqlwriter

Writes pandas DataFrame to several flavors of sql database

Flavors

  • Postres [complete]
  • Microsoft SQL [complete]
  • MySQL [complete]
  • Oracle [building]

Usage

from sqlwriter import SQLWriter
import psycopg2
import pandas as pd

conn = psycopg2.connect(**db_creds)
df = pd.DataFrame(data=range(10), columns=['numbers'])

writer = SQLWriter(conn=conn,
                   database='mydb',
                   table_name='table_name',
                   cols=df.columns,
                   truncate=True)
writer.write(df.values)
writer.close()

or

from sqlwriter import SQLDataFrame
import psycopg2

conn = psycopg2.connect(**db_creds)

df = SQLDataFrame(data=range(10), columns=['numbers'])
df.to_sql(conn=conn,
          database='mydb',
          table_name='table_name',
          cols=df.columns,
          truncate=True)

Project details


Download files

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

Files for sqlwriter, version 1.0.4
Filename, size File type Python version Upload date Hashes
Filename, size sqlwriter-1.0.4.tar.gz (10.2 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page