I'm trying to run the following code to read a table from another user on PgAdmin (he has already granted me select permission).It works when I try to get tables created by my own user, but not for other ones.
import pandas as pd
from sqlalchemy import create_engine
def recupera_bd(tablename):
param_dic = {
"host" : "PP-APPS",
"database" : "blabla",
"user" : "ltsurumaki",
"password" : "******"
}
connect = "postgresql+psycopg2://%s:%s@%s:5432/%s" % (
param_dic['user'],
param_dic['password'],
param_dic['host'],
param_dic['database']
)
engine = create_engine(connect)
df = pd.read_sql(tablename, con=engine)
return df
hbp = recupera_bd('consolidado_pnl')