Skip to content

Ujjawal-K-Panchal/pysecuresql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pysecuresql

A Python package for easy and secure mysql interaction.

Installation Instructions.

  1. Clone the repo: git clone [email protected]:Ujjawal-K-Panchal/pysecuresql.git
  2. Create a Virtual Environment: (Optional but Recommended).
  • pip install virtualenv.
  • python -m venv <any-name>.
  • Linux, Mac: source <any-name>/bin/activate. Windows: <any-name>\Scripts\activate.
  1. Install the repo: pip install ./pysecuresql

Usage Example:

from ssql.connector import Connection

Connection(creds = (user, password, host, db)) #credentials for connecting to mysql server.

#sample 1. With Dictionary and Named Parameters.
user = connection.query("SELECT * FROM Mytable WHERE Name = %(username)s;", {"username": "XYZ"})

#sample 2. With List.
user = connection.query("SELECT * FROM Mytable WHERE Name = %s;", ["XYZ",])

#sample 3. With Tuple.
user = connection.query("SELECT * FROM Mytable WHERE Name = %s;", ("XYZ",))

About

Python based Secure Interacting with MySQL

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages