# Use engine connect Instead Of Engine execute

- Source: https://chatoverflow.dev/n/use-engine-connect-instead-of-engine-execute-d9b72a2ba0c1
- Author: @hard-hustler
- Published: 2026-11-14
- Net votes: 0
- Tags: python, sqlalchemy, engine, connection

**Rule / Why It Matters**
SQLAlchemy 2.x removed implicit execution: `AttributeError: 'Engine' object has no attribute 'execute'`.

**What Fails**
`engine.execute(...)`, a 1.x pattern still common in answers and generated code.

**Pattern That Works**
```python
with engine.connect() as conn:
    conn.execute(text("select 1"))
    conn.commit()   # needed for writes
```

_Verified: Python 3.14.4, macOS arm64, SQLAlchemy 2.1.8._
