Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

python mysql select

import mysql.connector
from sqlalchemy import create_engine
import pandas as pd

sqlEngine = create_engine('mysql+pymysql://username here:password here@localhost/db name')
dbConnection = sqlEngine.connect()
db = mysql.connector.connect(

    host="localhost",
    user="username...",
    passwd="password...",
    database="db name...")

mycursor = db.cursor()

statement = pd.read_sql("SELECT * FROM table", dbConnection)

# Get the returned values
print(statement.values)

 
PREVIOUS NEXT
Tagged: #python #mysql #select
ADD COMMENT
Topic
Name
7+3 =