I've noticed the errors coincide with my DB reaching 100% CPU utilization.
Try to scale up the Database or try to Troubleshoot high cpu usage issues
You have to check the below conditions to overcome the Error
Cannot drop the table 'TABLE_NAME', because it does not exist or you do not have permission.
I hope you are doing the right way to drop a table and create the table if it does not exist. By using the below code
.to_sql(_name_, _con_, _schema=None_, _if_exists='replace'_, _index=True_, _index_label=None_, _chunksize=None_, _dtype=None_, _method=None_)
if_exists='replace' - Drop the table before inserting new values.
If you are using the same above you have to check the other possibilities.
- Use Truncate to drop the table before the .to_sql()
engine = sqlalchemy.create_engine('mssql+pyodbc://<Your SQL SERVER>/<DB NAMEE>')
conn = engine.connect()
conn.execute("TRUNCATE TABLE <TABLE NAME>")
.to_sql(_name_, _con_, _schema=None_, _if_exists='replace'_, _index=True_, _index_label=None_, _chunksize=None_, _dtype=None_, _method=None_)
- Make sure The User has all permissions to Access/Drop table.
- Check if the Table is already Drop before we actually run the .to_sql()