You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/integrations/prefect-sqlalchemy/index.mdx
+4-17Lines changed: 4 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -91,21 +91,8 @@ Use the `SqlAlchemyConnector` as a context manager, to ensure that the SQLAlchem
91
91
92
92
**Async support**
93
93
94
-
`SqlAlchemyConnector` supports async workflows. Just be sure to save, load, and use an async driver, as in the example below.
94
+
For async workflows with async database drivers (like `AsyncDriver.SQLITE_AIOSQLITE` or `AsyncDriver.POSTGRESQL_ASYNCPG`), use `AsyncSqlAlchemyConnector` instead of `SqlAlchemyConnector`. See the **Async** tab below for a complete example.
95
95
96
-
```python
97
-
from prefect_sqlalchemy import SqlAlchemyConnector, ConnectionComponents, AsyncDriver
98
-
99
-
connector = SqlAlchemyConnector(
100
-
connection_info=ConnectionComponents(
101
-
driver=AsyncDriver.SQLITE_AIOSQLITE,
102
-
database="DATABASE-PLACEHOLDER.db"
103
-
)
104
-
)
105
-
106
-
if__name__=="__main__":
107
-
connector.save("BLOCK_NAME-PLACEHOLDER")
108
-
```
109
96
</Note>
110
97
111
98
<Tabs>
@@ -164,13 +151,13 @@ if __name__ == "__main__":
164
151
165
152
```python
166
153
from prefect import flow, task
167
-
from prefect_sqlalchemy importSqlAlchemyConnector
154
+
from prefect_sqlalchemy importAsyncSqlAlchemyConnector
168
155
import asyncio
169
156
170
157
171
158
@task
172
159
asyncdefsetup_table(block_name: str) -> None:
173
-
asyncwithawaitSqlAlchemyConnector.load(block_name) as connector:
160
+
asyncwithawaitAsyncSqlAlchemyConnector.load(block_name) as connector:
174
161
await connector.execute(
175
162
"CREATE TABLE IF NOT EXISTS customers (name varchar, address varchar);"
0 commit comments