module sql.pandas_sql_helper

Short summary

module pyensae.sql.pandas_sql_helper

Pandas and SQL

source on GitHub

Functions

function

truncated documentation

import_flatfile_into_database_pandas

Function which imports a file into a database using pandas. It the table exists, it removes it first. There is no addition. …

Documentation

Pandas and SQL

source on GitHub

pyensae.sql.pandas_sql_helper.import_flatfile_into_database_pandas(filedb, filetext, table=None, engine='SQLite', host='localhost', add_key=None, fLOG=<built-in function print>, **options)

Function which imports a file into a database using pandas. It the table exists, it removes it first. There is no addition.

Parameters:
  • filedb – something.db3

  • filetext – something.txt or .tsv

  • table – table name (in the database), if None, the database name will be the filename without extension

  • engine – engine to use when using a SQL server (SQLite or ODBCMSSQL)

  • host – host (server)

  • fLOG – logging function (will display information through the command line)

  • add_key – name of a key to add (or None if nothing to add)

  • encoding – encoding

  • options – options passed to pandas.read_csv

Returns:

table name

source on GitHub