Skip to content

Commit

Permalink
Remove application of settings to sqlite
Browse files Browse the repository at this point in the history
  • Loading branch information
cicdw committed Jan 15, 2025
1 parent 70330a9 commit a0b8dd6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
4 changes: 3 additions & 1 deletion docs/v3/develop/settings-ref.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,8 @@ Number of seconds a runner should wait between heartbeats for flow runs.

---
## SQLAlchemySettings
Settings for controlling SQLAlchemy behavior
Settings for controlling SQLAlchemy behavior; note that these settings only take effect when
using a PostgreSQL database.
### `pool_size`
Controls connection pool size of database connection pools from the Prefect backend. If not set, the default SQLAlchemy pool size will be used.

Expand Down Expand Up @@ -1091,6 +1092,7 @@ The default limit applied to queries that can return multiple objects, such as `
## ServerDatabaseSettings
Settings for controlling server database behavior
### `sqlalchemy`
Settings for controlling SQLAlchemy behavior

**Type**: [SQLAlchemySettings](#sqlalchemysettings)

Expand Down
3 changes: 2 additions & 1 deletion schemas/settings.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@
"type": "object"
},
"SQLAlchemySettings": {
"description": "Settings for controlling SQLAlchemy behavior",
"description": "Settings for controlling SQLAlchemy behavior; note that these settings only take effect when\nusing a PostgreSQL database.",
"properties": {
"pool_size": {
"anyOf": [
Expand Down Expand Up @@ -923,6 +923,7 @@
"properties": {
"sqlalchemy": {
"$ref": "#/$defs/SQLAlchemySettings",
"description": "Settings for controlling SQLAlchemy behavior",
"supported_environment_variables": []
},
"connection_url": {
Expand Down
10 changes: 1 addition & 9 deletions src/prefect/server/database/configurations.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,7 @@ async def engine(self) -> AsyncEngine:
f"{sqlite3.sqlite_version}"
)

kwargs: dict[
str, Any
] = get_current_settings().server.database.sqlalchemy.model_dump(mode="json")
kwargs: dict[str, Any] = dict()

loop = get_running_loop()

Expand All @@ -353,12 +351,6 @@ async def engine(self) -> AsyncEngine:
if self.timeout is not None:
kwargs["connect_args"] = dict(timeout=self.timeout)

if self.sqlalchemy_pool_size is not None:
kwargs["pool_size"] = self.sqlalchemy_pool_size

if self.sqlalchemy_max_overflow is not None:
kwargs["max_overflow"] = self.sqlalchemy_max_overflow

# use `named` paramstyle for sqlite instead of `qmark` in very rare
# circumstances, we've seen aiosqlite pass parameters in the wrong
# order; by using named parameters we avoid this issue
Expand Down
3 changes: 2 additions & 1 deletion src/prefect/settings/models/server/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@

class SQLAlchemySettings(PrefectBaseSettings):
"""
Settings for controlling SQLAlchemy behavior
Settings for controlling SQLAlchemy behavior; note that these settings only take effect when
using a PostgreSQL database.
"""

model_config: ClassVar[ConfigDict] = _build_settings_config(
Expand Down

0 comments on commit a0b8dd6

Please sign in to comment.