Search
 
SCRIPT & CODE EXAMPLE
 

SQL

mysql connection python

from sqlalchemy import types, create_engine
import pymysql

try:
	conn = create_engine('mysql+pymysql://user:pass@IP/database_name')
  	print("MySQL Connection Sucessfull!!!!!!!!!!!")

except Exception as err:

	print("MySQL Connection Failed !!!!!!!!!!!")
	print(err)
Comment

python and mysql connectivity

import pymysql

############### CONFIGURE THIS ###################
# Open database connection
db = pymysql.connect("database_host","username","password","database_name")
##################################################

# prepare a cursor object using cursor() method
cursor = db.cursor()

# execute SQL query using execute() method.
cursor.execute("SELECT VERSION()")

# Fetch a single row using fetchone() method.
data = cursor.fetchone()
print ("Database version : {0}".format(data))

# disconnect from server
db.close()
Comment

PREVIOUS NEXT
Code Example
Sql :: delete query 
Sql :: sql trigger 
Sql :: what is union in sql 
Sql :: sqlite rename table 
Sql :: stored procedures example 
Sql :: mysql join 
Sql :: what is rownum in oracle 
Sql :: sql server interview questions 
Sql :: oracle temp tablespace size 
Sql :: psotgres multiple values 
Sql :: SQL SERVER microsoft How to Add Column at Specific Location in Table 
Sql :: create view in mysql workbench 
Sql :: mask data in sql 
Sql :: sql show custom constraints 
Sql :: enlever les doubles espaces dans les tables postgresql 
Csharp :: dropdown text mesh pro unity 
Csharp :: convert system.byte a string c# 
Csharp :: unity check if space pressed 
Csharp :: how to lerp in c# 
Csharp :: c# remove crlf from string 
Csharp :: c# for each textbox lines 
Csharp :: string to int c# unity 
Csharp :: how to make something addforce in the direction of something in untiy 
Csharp :: get scene name unity 
Csharp :: detecting a right click unity 
Csharp :: unity c# instantiate prefab 
Csharp :: how to change the title of the console in c# 
Csharp :: c# count number of occurrences in string 
Csharp :: c# read file into a string 
Csharp :: get remainder of number c# 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =