Eu baixei os códigos do projeto e estou visualizando no VS Code, executando cada célula junto com a aula, mas na célula:
query = 'DELETE FROM clientes WHERE ID_Cliente=5008804'
with engine.connect() as conn:
conn.execute(query)
Apareceu o seguinte erro:
AttributeError Traceback (most recent call last)
File c:\Users\Rafael\AppData\Local\Programs\Python\Python311\Lib\site-packages\sqlalchemy\engine\base.py:1412, in Connection.execute(self, statement, parameters, execution_options)
1411 try:
-> 1412 meth = statement._execute_on_connection
1413 except AttributeError as err:
AttributeError: 'str' object has no attribute '_execute_on_connection'
The above exception was the direct cause of the following exception:
ObjectNotExecutableError Traceback (most recent call last)
c:\Users\Rafael\Desktop\Pandas - trabalhando com diferentes formatos de arquivos\Aula_5\Aula_5.ipynb Célula 28 line 6
4 # para garantir que conexão com o banco de dados seja fechada corretamento após a consulta
5 with engine.connect() as conn:
----> 6 conn.execute(query)
File c:\Users\Rafael\AppData\Local\Programs\Python\Python311\Lib\site-packages\sqlalchemy\engine\base.py:1414, in Connection.execute(self, statement, parameters, execution_options)
1412 meth = statement._execute_on_connection
1413 except AttributeError as err:
-> 1414 raise exc.ObjectNotExecutableError(statement) from err
1415 else:
1416 return meth(
1417 self,
1418 distilled_parameters,
1419 execution_options or NO_OPTIONS,
1420 )
ObjectNotExecutableError: Not an executable object: 'DELETE FROM clientes WHERE ID_Cliente=5008804'