Last active
July 21, 2020 16:59
-
-
Save BexTuychiev/6a11d4f269b47081ace42b038f3ee9cf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
# Create a cursor object | |
cursor = connection.cursor() | |
# Execute any SQL query | |
results = cursor.execute(""" | |
SELECT table1.column1, table2.column2 | |
FROM table1 | |
JOIN table2 ON table1.primary = table2.foreign | |
ORDER BY 2 | |
""") | |
# Load into a DataFrame | |
df = pd.DataFrame(results.fetchall()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment