For programmers to need to access MySQL database by python,this tested source code is useful.
It is available to execute SQL statement like ‘create database’,’insert’,’select’,etc.
Also tables can be joined and use transaction by commit or rollback.
Specification
ID | STCD_0000000006 |
Language | Python |
Steps | 292 |
Purpose | Operate MYSQL database. |
Function | create database create table show columns create index insert update select delete drop index drop table drop database commit rollback |
Environment | Anaconda3(Python 3.9.7) IDE : Visual Studio Code mysql mysql_connector |
Restriction | free license You can use source code copy as owner . You can customize and distribute it freely. |
Price | 7 dollars or 700 yen (Pay with PayPal) |
References | https://dev.mysql.com/doc/connector-python/en/connector-python-introduction.html https://dev.mysql.com/doc/connector-python/en/connector-python-api-mysqlcursor-execute.html https://isgs-lab.com/613/ |
Source Code
Test Result
NO | test case | result |
01 | sql function test – create database – create table – show columns – create index – insert – update – select – delete – drop index – drop table – drop database | OK |
02 | join table test – inner join – outer join | OK |
03 | transaction test – commit – rollback | OK |
Test Code
*) Modify “path” along your PC environment.
History
26/11/2022 created
Provider Profile
Nick name is “Dead Fish” employed as an engineer in Japan.
I am grad if you need my code.
Thanks !
Download
Get download passwordSTCD_0000000006
1 file(s) 0.18 KB
Following files and data are zipped.
└── DbClass.py
Remarks
None
Comments