简体   繁体   中英

Azure blob storage trigger losing permissions after being run for a while?

I ran an azure function for about an hour and a half and then started receiving these errors when it tried to drop tables:

Cannot drop the table 'TABLE_NAME', because it does not exist or you do not have permission.

I've checked the tables, they exist, but my function has somehow lost its permissions it seems, or something else is happening that I'm unaware of. Anyone have any suggestions as to how to fix this?

EDIT: I've noticed the errors coincide with my DB reaching 100% CPU utilization.

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()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM