<div dir="ltr"><div dir="ltr">Hi David,<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno dom 29 nov 2020 alle ore 01:20 Shaozhong SHI <<a href="mailto:shishaozhong@gmail.com">shishaozhong@gmail.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div dir="ltr"><div>Hi, <br></div><div><br></div><div>I keep getting the following error when I use engine = create_engine(logging in details to postgres)</div><div>df.to_sql('table_name', and etc.)</div><div><br></div><div><br></div>OperationalError: (psycopg2.OperationalError) SSL connection has been closed unexpectedly<br><br>(Background on this error at: <a href="http://sqlalche.me/e/13/e3q8" target="_blank">http://sqlalche.me/e/13/e3q8</a>)<br>OperationalError: (psycopg2.OperationalError) SSL connection has been closed unexpectedly<br><div><br></div><div>Can anyone shed any light on this?</div></div></div></div></blockquote><div><br></div><div>This question is not really related to PostGIS, anyway...</div><div><br></div><div>Looks like you are trying to persist a Python Pandas dataframe into a PostgreSQL table using</div><div>SQLAlchemy as driver. You are omitting to specify the connection string you used to create the engine</div><div>that needs to be passed into the to_sql() Pandas' method, but the issue is probably there:</div><div>the OperationlError exception is generally raised when SQLAlchemy is not able to open a proper connection</div><div>to the DB.</div><div><br></div><div>Giuseppe.<br></div></div></div>