18 lines
454 B
Python
18 lines
454 B
Python
from sqlalchemy import create_engine
|
|
import pandas as pd
|
|
|
|
pd.options.blipblop = 23
|
|
# A long string that contains the necessary Postgres login information
|
|
connection_string = "postgresql://{username}:{password}@{ipaddress}:{port}/{dbname}"
|
|
|
|
# Create the connection
|
|
connection = create_engine(connection_string)
|
|
|
|
# Load the data into a DataFrame
|
|
df = pd.read_sql_query("SELECT * FROM table_name", connection)
|
|
|
|
# Close the connection
|
|
connection.dispose()
|
|
|
|
|