Skip to content

Tortoise.generate_schemas() raises exception #2037

Closed

Description

@axzxc1236

Describe the bug
await Tortoise.generate_schemas() doesn't work anymore.
Still happens while trying to follow "Getting started" documentation

Traceback (most recent call last):
  File "/tmp/tortoise_orm_test/main.py", line 13, in <module>
    run_async(main())
    ~~~~~~~~~^^^^^^^^
  File "/tmp/tortoise_orm_test/.venv/lib/python3.13/site-packages/tortoise/__init__.py", line 643, in run_async
    loop.run_until_complete(coro)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/usr/lib/python3.13/asyncio/base_events.py", line 725, in run_until_complete
    return future.result()
           ~~~~~~~~~~~~~^^
  File "/tmp/tortoise_orm_test/main.py", line 11, in main
    await Tortoise.generate_schemas()
  File "/tmp/tortoise_orm_test/.venv/lib/python3.13/site-packages/tortoise/__init__.py", line 594, in generate_schemas
    await generate_schema_for_client(connection, safe)
  File "/tmp/tortoise_orm_test/.venv/lib/python3.13/site-packages/tortoise/utils.py", line 46, in generate_schema_for_client
    await generator.generate_from_string(schema)
  File "/tmp/tortoise_orm_test/.venv/lib/python3.13/site-packages/tortoise/backends/base/schema_generator.py", line 504, in generate_from_string
    await self.client.execute_script(creation_string)
  File "/tmp/tortoise_orm_test/.venv/lib/python3.13/site-packages/tortoise/backends/sqlite/client.py", line 43, in translate_exceptions_
    return await func(self, query, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/tortoise_orm_test/.venv/lib/python3.13/site-packages/tortoise/backends/sqlite/client.py", line 167, in execute_script
    async with self.acquire_connection() as connection:
               ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/tmp/tortoise_orm_test/.venv/lib/python3.13/site-packages/tortoise/backends/base/client.py", line 266, in __aenter__
    await self.ensure_connection()
  File "/tmp/tortoise_orm_test/.venv/lib/python3.13/site-packages/tortoise/backends/base/client.py", line 261, in ensure_connection
    await self.client.create_connection(with_db=True)
  File "/tmp/tortoise_orm_test/.venv/lib/python3.13/site-packages/tortoise/backends/sqlite/client.py", line 82, in create_connection
    self._connection.start()
    ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Connection' object has no attribute 'start'

To Reproduce
uv add tortoise-orm\[accel\] typing_extensions
Follow https://tortoise.github.io/getting_started.html

Expected behavior
I think it worked until very recently, I don't know what is wrong or changed with my environment, I found out it no longer works today.

Additional context
Python version 3.13.11
Output of uv tree

tortoise-orm-test v0.1.0
├── tortoise-orm[accel] v0.25.1
│   ├── aiosqlite v0.22.0
│   ├── iso8601 v2.1.0
│   ├── pypika-tortoise v0.6.3
│   ├── pytz v2025.2
│   ├── ciso8601 v2.3.3 (extra: accel)
│   ├── orjson v3.11.5 (extra: accel)
│   └── uvloop v0.22.1 (extra: accel)
└── typing-extensions v4.15.0

Activity

  1. axzxc1236 commented on Dec 14, 2025

    @axzxc1236
    Author

    Mitigated by downgrading aiosqlite to old version, you need to pin old version of aiosqlite as dependency.

    uv add aiosqlite==0.21.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions