I'm currently develop a Jupyter notebook with Python code, in Mac OSX Mojave 10.14. I'm using Psycopg2 to get data from PostgreSQL to Python Dataframe.
The problem is the code works fine in Win 10, in two ways, but I not get data from the same query in Mac OSX.
I don't get any error, I just get an empty Dataframe. Nothing more. No error, no warning.
Anyone have been in the same trouble?
The used code is below:
First option:
cursor = conn.cursor()
query = """select * from table"""
cursor.execute(query)
data = data.append(cursor.fetchall())
data.columns = [desc[0] for desc in cursor.description]
Second option:
data= pd.DataFrame()
for chunk in pd.read_sql("""select * from table""", con=conn, chunksize=5000):
data= data.append(chunk)
I expect a Dataframe with the data from PostgreSQL.