Skip to main content

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

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page