This Is MySQL Package That You Can Save DataFrame As Table, Partition, Update , Primarykey And Unique In MySQL
Project description
First of all , you must connect to your mysql database with this function :
from mysqlSaver.mysqlSaver import *
your_connection = Connection.connect("your_host" , "your_port" , "your_username" , "your_password" , "your_databasename")
When you make connection to your owen database , you can use "your_connection" variable to use other function like this , for example :
from mysqlSaver.mysqlSaver import *
import pandas as pd
your_connection = Connection.connect("your_host" , "your_port" , "your_username" , "your_password" , "your_databasename")
df = pd.DataFrame({"name" : ['john'] , "lastname" : ["doe"] , 'age' : [19]})
df_saver = Saver(your_connection)
df_saver.sql_saver(df , "your_table")
In this function, at first, according to the create_table function, the table is created based on the type of each column in the dataframe . You can use other functions such as partition and primarykey and etc. in the same way. But some functions like sql_saver_with_primarykey(), we need to give more inputs to be saved in the desired way. For example:
from mysqlSaver.mysqlSaver import *
import pandas as pd
your_connection = Connection.connect("your_host" , "your_port" , "your_username" , "your_password" , "your_databasename")
df = pd.DataFrame({"name" : ['john'] , "lastname" : ["doe"] , 'age' : [19]})
df_saver_by_primary_key = Saver(your_connection)
df_saver_by_primary_key.sql_saver_with_primarykey(df , "your_table" , ['lastname'])
In the code above, you give the function a primary key by typing list and it will set and save your table based on that primary key.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file mysqlSaver-0.1.9.tar.gz.
File metadata
- Download URL: mysqlSaver-0.1.9.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70e72c468b0c83fe6ee527c5593f00e074cac563ba45efe10fe30a9f445d5a90
|
|
| MD5 |
8a2eada71686d217340301ea77c0c9c1
|
|
| BLAKE2b-256 |
fc1ce77789e20ba229ad3e396a109e50f18a6713dc2e36bfc0a42add57432b62
|