Skip to main content

MySQLPandas: simple connector between MySQL(MariaDB) and Pandas

Project description

MySQLPandas

pages-build-deployment Version PyPI License: GPL v2

Overview

Simple connector between MySQL(MariaDB) and Pandas

Description

This tool is primarily intended to help Python users easily handle databases. It uses Pandas as its base, so it should be easy to use even for those who are not familiar with databases. The tool supports MySQL or MariaDB as the database engine.

Demo

  • Make new table and install dataframe or csv
from MySQLPandas.core import MySQLPandas
with MySQLPandas("hoge","hoge_db",initfile_path="hoge.ini") as obj:
    obj.makeTable("sample_table",df_path="sample.csv")
    obj.showTableinfo("sample_table")
    obj.insertRecord("sample_table",df_path="sample.csv")

Regarding other functions, see here.

Note

In MySQLPandas function of insertRecord, it doesn't allow any difference on table denfinition.(If it has slightly differcence, MySQLPandas raise error.)

raise PandasMySQLError("Not match Table frame")
MySQLPandas.lib.ErrorClass.PandasMySQLError: Not match Table frame

If you want to change table definition, please see below.

  • Change string type column
    You can change table denfiniton automatically. Please rewrite "Strict_Mode = False" in "insertRecord" method.
  • Change int or float type column
    Sorry, you can't change it in MySQLPandas. Please rewrite it by using "executeSQLcommand" method.

0.0.19 ~

  • Columns are no longer automatically assigned an underscore instead of a space when the database is created. However, it is recommended to replace them with underbars as much as possible, since spaces may cause unintended behavior.

Setup password.ini

In default, you need to input DB password in your console every time.
If you felt bothered, you avoid this by creating "password.ini" file.
In GitHub page, it's put sample file.

Requirement

  • MySQL(MariaDB)
    The version of Auther's MariaDB is 5.5.68-MariaDB MariaDB Server.
    Don't try the newest version so please check your MariaDB version.
  • Pandas <= 1.5.3
  • Python 3.*
  • mysql-connector-python <= 8.0.29
  • tqdm <= 4.65.0

Developer Guide

See here.

Install

Install through pip.

pip install MySQLPandas

Licence

GNU GPLv2

Author

Sota Nakashima

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

MySQLPandas-0.0.19.tar.gz (15.9 kB view hashes)

Uploaded Source

Built Distribution

MySQLPandas-0.0.19-py3-none-any.whl (15.5 kB view hashes)

Uploaded Python 3

Supported by

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