A database migrations tool for TortoiseORM, ready to production.

Overview

Aerich

image image image image

Introduction

Aerich is a database migrations tool for Tortoise-ORM, which is like alembic for SQLAlchemy, or like Django ORM with it's own migration solution.

Install

Just install from pypi:

pip install aerich

Quick Start

> aerich -h

Usage: aerich [OPTIONS] COMMAND [ARGS]...

Options:
  -V, --version      Show the version and exit.
  -c, --config TEXT  Config file.  [default: pyproject.toml]
  --app TEXT         Tortoise-ORM app name.
  -h, --help         Show this message and exit.

Commands:
  downgrade  Downgrade to specified version.
  heads      Show current available heads in migrate location.
  history    List all migrate items.
  init       Init config file and generate root migrate location.
  init-db    Generate schema and generate app migrate location.
  inspectdb  Introspects the database tables to standard output as...
  migrate    Generate migrate changes file.
  upgrade    Upgrade to specified version.

Usage

You need add aerich.models to your Tortoise-ORM config first. Example:

TORTOISE_ORM = {
    "connections": {"default": "mysql://root:[email protected]:3306/test"},
    "apps": {
        "models": {
            "models": ["tests.models", "aerich.models"],
            "default_connection": "default",
        },
    },
}

Initialization

> aerich init -h

Usage: aerich init [OPTIONS]

  Init config file and generate root migrate location.

Options:
  -t, --tortoise-orm TEXT  Tortoise-ORM config module dict variable, like
                           settings.TORTOISE_ORM.  [required]
  --location TEXT          Migrate store location.  [default: ./migrations]
  -s, --src_folder TEXT    Folder of the source, relative to the project root.
  -h, --help               Show this message and exit.

Initialize the config file and migrations location:

> aerich init -t tests.backends.mysql.TORTOISE_ORM

Success create migrate location ./migrations
Success write config to pyproject.toml

Init db

> aerich init-db

Success create app migrate location ./migrations/models
Success generate schema for app "models"

If your Tortoise-ORM app is not the default models, you must specify the correct app via --app, e.g. aerich --app other_models init-db.

Update models and make migrate

> aerich migrate --name drop_column

Success migrate 1_202029051520102929_drop_column.sql

Format of migrate filename is {version_num}_{datetime}_{name|update}.sql.

If aerich guesses you are renaming a column, it will ask Rename {old_column} to {new_column} [True]. You can choose True to rename column without column drop, or choose False to drop the column then create. Note that the latter may lose data.

Upgrade to latest version

> aerich upgrade

Success upgrade 1_202029051520102929_drop_column.sql

Now your db is migrated to latest.

Downgrade to specified version

> aerich downgrade -h

Usage: aerich downgrade [OPTIONS]

  Downgrade to specified version.

Options:
  -v, --version INTEGER  Specified version, default to last.  [default: -1]
  -d, --delete           Delete version files at the same time.  [default:
                         False]

  --yes                  Confirm the action without prompting.
  -h, --help             Show this message and exit.
> aerich downgrade

Success downgrade 1_202029051520102929_drop_column.sql

Now your db is rolled back to the specified version.

Show history

> aerich history

1_202029051520102929_drop_column.sql

Show heads to be migrated

> aerich heads

1_202029051520102929_drop_column.sql

Inspect db tables to TortoiseORM model

Currently inspectdb only supports MySQL.

Usage: aerich inspectdb [OPTIONS]

  Introspects the database tables to standard output as TortoiseORM model.

Options:
  -t, --table TEXT  Which tables to inspect.
  -h, --help        Show this message and exit.

Inspect all tables and print to console:

aerich --app models inspectdb

Inspect a specified table in the default app and redirect to models.py:

aerich inspectdb -t user > models.py

Note that this command is limited and cannot infer some fields, such as IntEnumField, ForeignKeyField, and others.

Multiple databases

tortoise_orm = {
    "connections": {
        "default": expand_db_url(db_url, True),
        "second": expand_db_url(db_url_second, True),
    },
    "apps": {
        "models": {"models": ["tests.models", "aerich.models"], "default_connection": "default"},
        "models_second": {"models": ["tests.models_second"], "default_connection": "second", },
    },
}

You only need to specify aerich.models in one app, and must specify --app when running aerich migrate and so on.

Restore aerich workflow

In some cases, such as broken changes from upgrade of aerich, you can't run aerich migrate or aerich upgrade, you can make the following steps:

  1. drop aerich table.
  2. delete migrations/{app} directory.
  3. rerun aerich init-db.

Note that these actions is safe, also you can do that to reset your migrations if your migration files is too many.

Use aerich in application

You can use aerich out of cli by use Command class.

from aerich import Command

command = Command(tortoise_config=config, app='models')
await command.init()
await command.migrate('test')

License

This project is licensed under the Apache-2.0 License.

Comments
  • @long2ice  Hello, regarding Module

    @long2ice Hello, regarding Module "\migrations\models\old_models" not found, I used your method above and still failed to solve my problem. Is there any other way to deal with it?

    opened by zhangyuxin123 23
  • Parameter `db_constraint` in the model are not recognized

    Parameter `db_constraint` in the model are not recognized

    Hi, I use aerich in mysql and I found aerich can't recognized models parameter db_constraint

    this is my model :

    class Comment(models.Model):
        id = fields.IntField(pk=True)
        article_id = fields.ForeignKeyField('models.Blog', to_field="article_id", on_delete=fields.CASCADE,
                                            db_constraint=False)
        content = fields.TextField()
        parent = fields.ForeignKeyField('models.Comment', null=True, on_delete=fields.SET_NULL, db_constraint=False)
        name = fields.CharField(max_length=32)
        email = fields.CharField(max_length=255)
        c_time = fields.DatetimeField(auto_now_add=True)
    

    and I found this sql in models json file:

    CONSTRAINT `fk_comments_comments_ab2e55ce` FOREIGN KEY (`parent_id`) REFERENCES `comments` (`id`) ON DELETE SET NULL,
    
    

    I think it's a little bug, come on, I keep an eye on you

    wait feedback 
    opened by miss85246 21
  • 0.3.2 无法识别变更并且创建新的migration json

    0.3.2 无法识别变更并且创建新的migration json

    aerich init -t app.db.base.TORTOISE_CONFIG

    Success create migrate location ./migrations Success generate config file aerich.ini

    # aerich.ini
    [aerich]
    tortoise_orm = app.db.base.TORTOISE_CONFIG
    location = ./migrations
    

    aerich init-db

    Success create app migrate location ./migrations/models Success generate schema for app "models"

    生成了 ./migrations/models/9_20201030080750_None.json


    aerich heads

    No available heads,try migrate first


    aerich migrate

    Success migrate 10_20201030080825_update.json

    这里生成的json包含了upgrade和downgrade

    • upgrade里面的SQL语句都是CREATE TABLE IF NOT EXISTS ...
    • downgrade里面的SQL语句都是DROP TABLE IF EXISTS ...

    这好像是又重复了9_20201030080750_None.json的内容,为什么会这样? 另外,downgrade好像很危险,如果执行了那么所有的表就都删除了?


    修改models,增加了几个fields ... aerich migrate --name add_column

    Success migrate 10_20201030080907_add_column.json

    上一次migrate产生的 10_20201030080825_update.json被这次migrate产生的10_20201030080907_add_column.json给覆盖了,这里不是应该新增一个描述models变更的SQL语句的json吗? 10_20201030080907_add_column.json里面的内容也是CREATE TABLE IF NOT EXISTS ...DROP TABLE IF EXISTS ...,根本无法完成数据库表结构的变更,为什么会这样?

    opened by filwaline 20
  • error setting up

    error setting up

    @long2ice I'm new to Tortoise ORM and aerich. I'm trying to use it with the FastAPI framework. Whenever I try setting up. I keep receiving this error:

    Usage: aerich [OPTIONS] COMMAND [ARGS]...
    Try "aerich -h" for help.
    
    Error: No config named "tests.backends.mysql"
    

    How do I set up them up together, the documentation so far isn't forthcoming

    opened by gabbyprecious 15
  • 出现Error: No config named

    出现Error: No config named "xxx"是版本不兼容问题吗?

    环境: python:3.9.5 tortoise-orm:0.17.3 aerich:0.5.3 OS:windowns10

    问题描述: 运行aerich init -t xxx.TORTOISE_ORM后,能够正常生成aerich.ini文件和migrations目录 但是,接下来运行 aerich init-db时,出现提示Error: No config named "xxx"

    网上搜了一圈,好像也没什么人碰到这个问题,只看到有1个链接是一样的问题,但是没有解决: https://ask.csdn.net/questions/3985644 希望老大能在百忙之中,能否帮忙看看是什么地方出现问题了呀

    opened by h25302 14
  • tortoise.exceptions.ConfigurationError: Unknown connection

    tortoise.exceptions.ConfigurationError: Unknown connection "default" for app "diff_models"

    database_config = {
        "connections": {
            Database.telegram.name: Database.telegram.value
        },
        "apps": {
            "telegram": {
                "models": models,
                "default_connection": Database.telegram.name
            },
        },
    }
    

    [Mon May 25 18:20:25 2020]: Executing step 1 Success create migrate location ./migrations Success generate config file aerich.ini

    [Mon May 25 18:20:25 2020]: Executing step 2 Success create app migrate location ./migrations/telegram Success generate schema for app "telegram"

    [Mon May 25 18:20:26 2020]: Executing step 3

    docker exec -it telegramcms.services aerich migrate --name drop_column docker exec -it telegramcms.services aerich upgrade

    Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/tortoise/init.py", line 417, in _init_apps cls.get_connection(info.get("default_connection", "default")) File "/usr/local/lib/python3.8/dist-packages/tortoise/init.py", line 45, in get_connection return cls._connections[connection_name] KeyError: 'default'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last): File "/usr/local/bin/aerich", line 8, in sys.exit(main()) File "/usr/local/lib/python3.8/dist-packages/aerich/cli.py", line 224, in main cli(_anyio_backend="asyncio") File "/usr/local/lib/python3.8/dist-packages/asyncclick/core.py", line 799, in call return anyio.run(self._main, main, args, kwargs, backend=_anyio_backend) File "/usr/local/lib/python3.8/dist-packages/anyio/init.py", line 68, in run return asynclib.run(func, *args, **backend_options) # type: ignore File "/usr/local/lib/python3.8/dist-packages/anyio/_backends/_asyncio.py", line 97, in run raise exception File "/usr/local/lib/python3.8/dist-packages/anyio/_backends/_asyncio.py", line 67, in wrapper retval = await func(*args) File "/usr/local/lib/python3.8/dist-packages/asyncclick/core.py", line 802, in _main return await main(*args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/asyncclick/core.py", line 748, in main rv = await self.invoke(ctx) File "/usr/local/lib/python3.8/dist-packages/asyncclick/core.py", line 1172, in invoke await Command.invoke(self, ctx) File "/usr/local/lib/python3.8/dist-packages/asyncclick/core.py", line 994, in invoke return await ctx.invoke(self.callback, **ctx.params) File "/usr/local/lib/python3.8/dist-packages/asyncclick/core.py", line 588, in invoke rv = await rv File "/usr/local/lib/python3.8/dist-packages/aerich/cli.py", line 64, in cli await Migrate.init_with_old_models(tortoise_config, app, location) File "/usr/local/lib/python3.8/dist-packages/aerich/migrate.py", line 59, in init_with_old_models await Tortoise.init(config=migrate_config) File "/usr/local/lib/python3.8/dist-packages/tortoise/init.py", line 556, in init cls._init_apps(apps_config) File "/usr/local/lib/python3.8/dist-packages/tortoise/init.py", line 419, in _init_apps raise ConfigurationError( tortoise.exceptions.ConfigurationError: Unknown connection "default" for app "diff_models"

    opened by codefather-labs 12
  • Added config option to specify source folder

    Added config option to specify source folder

    Added an configuration option to specify the path of the source folder. This will make aerich work with various folder structures (e.g. ./src/MyPythonModule) Additionally this will try to import in init and show the user the error message on failure.

    opened by spacemanspiff2007 11
  • Can't upgrade: another operation is in progress

    Can't upgrade: another operation is in progress

    Can't upgrade new database to the latest version.

    How to reproduce

    1. Create any app
    2. Init aerich (creates aerich.ini and migrations folder)
    3. Init db (creates migrations/models/0_datetime_init.sql migration and add line to aerich table with 0 version)
    4. Get new clean database or drop all tables
    5. Run aerich upgrade

    Expected behavior

    Database filled with tables from migrations/models/ migrations

    Real behavior

    aerich upgrade

    Traceback (most recent call last):
      File "venv/lib/python3.9/site-packages/tortoise/backends/asyncpg/client.py", line 176, in execute_query
        rows = await connection.fetch(*params)
      File "venv/lib/python3.9/site-packages/asyncpg/connection.py", line 583, in fetch
        return await self._execute(
      File "venv/lib/python3.9/site-packages/asyncpg/connection.py", line 1625, in _execute
        result, _ = await self.__execute(
      File "venv/lib/python3.9/site-packages/asyncpg/connection.py", line 1650, in __execute
        return await self._do_execute(
      File "venv/lib/python3.9/site-packages/asyncpg/connection.py", line 1677, in _do_execute
        stmt = await self._get_statement(
      File "venv/lib/python3.9/site-packages/asyncpg/connection.py", line 375, in _get_statement
        statement = await self._protocol.prepare(
      File "asyncpg/protocol/protocol.pyx", line 166, in prepare
    RuntimeError: Task <Task pending name='Task-4' coro=<upgrade() running at venv/lib/python3.9/site-packages/aerich/cli.py:108> cb=[run_until_complete.<locals>.done_cb()]> got Future <Future pending cb=[Protocol._on_waiter_completed()]> attached to a different loop
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "venv/bin/aerich", line 8, in <module>
        sys.exit(main())
      File "venv/lib/python3.9/site-packages/aerich/cli.py", line 309, in main
        cli()
      File "venv/lib/python3.9/site-packages/click/core.py", line 829, in __call__
        return self.main(*args, **kwargs)
      File "venv/lib/python3.9/site-packages/click/core.py", line 782, in main
        rv = self.invoke(ctx)
      File "venv/lib/python3.9/site-packages/click/core.py", line 1259, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "venv/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "venv/lib/python3.9/site-packages/click/core.py", line 610, in invoke
        return callback(*args, **kwargs)
      File "venv/lib/python3.9/site-packages/click/decorators.py", line 21, in new_func
        return f(get_current_context(), *args, **kwargs)
      File "venv/lib/python3.9/site-packages/aerich/cli.py", line 38, in wrapper
        loop.run_until_complete(f(*args, **kwargs))
      File "uvloop/loop.pyx", line 1494, in uvloop.loop.Loop.run_until_complete
      File "venv/lib/python3.9/site-packages/aerich/cli.py", line 108, in upgrade
        exists = await Aerich.exists(version=version_file, app=app)
      File "venv/lib/python3.9/site-packages/tortoise/queryset.py", line 959, in _execute
        result, _ = await self._db.execute_query(str(self.query))
      File "venv/lib/python3.9/site-packages/tortoise/backends/asyncpg/client.py", line 36, in translate_exceptions_
        return await func(self, *args)
      File "venv/lib/python3.9/site-packages/tortoise/backends/asyncpg/client.py", line 177, in execute_query
        return len(rows), rows
      File "venv/lib/python3.9/site-packages/asyncpg/pool.py", line 218, in release
        raise ex
      File "venv/lib/python3.9/site-packages/asyncpg/pool.py", line 208, in release
        await self._con.reset(timeout=budget)
      File "venv/lib/python3.9/site-packages/asyncpg/connection.py", line 1311, in reset
        await self.execute(reset_query, timeout=timeout)
      File "venv/lib/python3.9/site-packages/asyncpg/connection.py", line 297, in execute
        return await self._protocol.query(query, timeout)
      File "asyncpg/protocol/protocol.pyx", line 321, in query
      File "asyncpg/protocol/protocol.pyx", line 684, in asyncpg.protocol.protocol.BaseProtocol._check_state
    asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress
    

    Versions

    asyncpg = "^0.22.0"
    aerich = "^0.5.0"
    tortoise-orm = "^0.16.18"
    
    opened by Olegt0rr 11
  • No changes detected

    No changes detected

    I am separating the models in different files, on the right you can see the script "settings.py" that allows me to load the modules where I have the models, when I do an "init-db" it works without problems, the other commands work but when I want to do the migrations, it says that it does not detect changes, I am seeing that some people are having the same problem, previously I got an error like this: "old_model does not have the method/attribute 'pop'", (I forgot to take the capture and did a "clear" unconsciously).

    I'm using FastAPI, Aerich, TortoiseORM and Dynaconf.

    image

    bug 
    opened by facundopadilla 11
  • error: cannot import name '_wrap_std_stream' from 'asyncclick._winconsole'

    error: cannot import name '_wrap_std_stream' from 'asyncclick._winconsole'

    My system is windows. aerich version: dev. When I try to use aerich init -h and then I got the error: (aerichtest-Io3kg-ro-py3.8) C:\Users\surface\PycharmProjects\aerichTest>aerich init -h Traceback (most recent call last): File "C:\Users\surface\AppData\Local\pypoetry\Cache\virtualenvs\aerichtest-Io3kg-ro- py3.8\Scripts\aerich-script.py", line 11, in <module> load_entry_point('aerich', 'console_scripts', 'aerich')() File "c:\users\surface\appdata\local\pypoetry\cache\virtualenvs\aerichtest-io3kg-ro- py3.8\lib\site-packages\pkg_resources\__init__.py", line 490, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "c:\users\surface\appdata\local\pypoetry\cache\virtualenvs\aerichtest-io3kg-ro- py3.8\lib\site-packages\pkg_resources\__init__.py", line 2862, in load_entry_point return ep.load() File "c:\users\surface\appdata\local\pypoetry\cache\virtualenvs\aerichtest-io3kg-ro- py3.8\lib\site-packages\pkg_resources\__init__.py", line 2462, in load return self.resolve() File "c:\users\surface\appdata\local\pypoetry\cache\virtualenvs\aerichtest-io3kg-ro- py3.8\lib\site-packages\pkg_resources\__init__.py", line 2468, in resolve module = __import__(self.module_name, fromlist=['__name__'], level=0) File "c:\users\surface\appdata\local\pypoetry\cache\virtualenvs\aerichtest-io3kg-ro- py3.8\src\aerich\aerich\cli.py", line 8, in <module> import asyncclick as click File "c:\users\surface\appdata\local\pypoetry\cache\virtualenvs\aerichtest-io3kg-ro- py3.8\lib\site-packages\asyncclick\__init__.py", line 7, in <module> from .core import Argument File "c:\users\surface\appdata\local\pypoetry\cache\virtualenvs\aerichtest-io3kg-ro-py3.8\lib\site-packages\asyncclick\core.py", line 18, in <module> from ._compat import isidentifier File "c:\users\surface\appdata\local\pypoetry\cache\virtualenvs\aerichtest-io3kg-ro-py3.8\lib\site-packages\asyncclick\_compat.py", line 540, in <module> from ._winconsole import _get_windows_console_stream, _wrap_std_stream ImportError: cannot import name '_wrap_std_stream' from 'asyncclick._winconsole' (c:\users\surface\appdata\local\pypoetry\cache\virtualenvs\aerichtest-io3kg-ro-py3.8\lib\site-packa ges\asyncclick\_winconsole.py)

    opened by ShirleyChau 10
  • Build multiple databases on the window. When initializing, the -- app parameter fails and an error is reported

    Build multiple databases on the window. When initializing, the -- app parameter fails and an error is reported

    image image

    TORTOISE_ORM = {
    'connections': {
        'default': {
            # 'engine': 'tortoise.backends.asyncpg',  PostgreSQL
            'engine': 'tortoise.backends.mysql',  # MySQL or Mariadb
            'credentials': {
                'host': 'x.x.x.x',
                'port': '3306',
                'user': 'root',
                'password': 'xxxxxxxx',
                'database': 'fastapi',
                'minsize': 1,
                'maxsize': 200,
                'charset': 'utf8mb4',
                "echo": True
            }
        },
        'aorui_test': {
            # 'engine': 'tortoise.backends.asyncpg',  PostgreSQL
            'engine': 'tortoise.backends.mysql',  # MySQL or Mariadb
            'credentials': {
                # 'host': '172.17.0.1',
                'host': 'x.x.x.x',
                'port': '3306',
                'user': 'root',
                'password': 'xxxxxxxx',
                'database': 'aorui_test',
                'minsize': 1,
                'maxsize': 200,
                'charset': 'utf8mb4',
                "echo": True
            }
        },
    },
    'apps': {
        "default": {
            'models': ['apps.download.models', "aerich.models"],
            "default_connection": "default"
        },
        "aorui_test": {
            'models': ['apps.aorui_test.models'],
            "default_connection": "aorui_test"
        },
    },
    'use_tz': False,
    'timezone': 'Asia/Shanghai'}
    

    When I try to use aerich --app=default init db , this command causes the error shown in the first figure; When I try to locate the error, I find that replacing related_app_name with app_name can solve the problem. I expect you to fix this bug in the next version

    position at __init__.py is about 160 lines
    

    image

    opened by forverkg 8
  • Fix field dropping & CI checks

    Fix field dropping & CI checks

    Currently, dropping fields seem to only result to a KeyError. This PR fixes that by resorting to the default field name

    !! Please review thoroughly to prevent unintentional side-effects as I do not have intensive knowledge on aerich's flow and architecture !!

    opened by CortexPE 0
  • Duplicates in migration

    Duplicates in migration

    Im change CharField to DateTime and use aerich migrate

    Migration file look like this:

    async def upgrade(db: BaseDBAsyncClient) -> str:
        return """
            ALTER TABLE "company" ALTER COLUMN "ogrn_data_reg" TYPE TIMESTAMPTZ USING "ogrn_data_reg"::TIMESTAMPTZ;
            ALTER TABLE "company" ALTER COLUMN "ogrn_data_reg" TYPE TIMESTAMPTZ USING "ogrn_data_reg"::TIMESTAMPTZ;
            ALTER TABLE "company" ALTER COLUMN "ogrn_data_reg" TYPE TIMESTAMPTZ USING "ogrn_data_reg"::TIMESTAMPTZ;
            ALTER TABLE "company" ALTER COLUMN "ogrn_data_reg" TYPE TIMESTAMPTZ USING "ogrn_data_reg"::TIMESTAMPTZ;
            ALTER TABLE "company" ALTER COLUMN "ogrn_data_reg" TYPE TIMESTAMPTZ USING "ogrn_data_reg"::TIMESTAMPTZ;"""
    
    async def downgrade(db: BaseDBAsyncClient) -> str:
        return """
            ALTER TABLE "company" ALTER COLUMN "ogrn_data_reg" TYPE VARCHAR(255) USING "ogrn_data_reg"::VARCHAR(255);
            ALTER TABLE "company" ALTER COLUMN "ogrn_data_reg" TYPE VARCHAR(255) USING "ogrn_data_reg"::VARCHAR(255);
            ALTER TABLE "company" ALTER COLUMN "ogrn_data_reg" TYPE VARCHAR(255) USING "ogrn_data_reg"::VARCHAR(255);
            ALTER TABLE "company" ALTER COLUMN "ogrn_data_reg" TYPE VARCHAR(255) USING "ogrn_data_reg"::VARCHAR(255);
            ALTER TABLE "company" ALTER COLUMN "ogrn_data_reg" TYPE VARCHAR(255) USING "ogrn_data_reg"::VARCHAR(255);"""
    

    I removed duplocate and successfully make aerich upgrade.

    Is it ok?

    opened by Maksim-Burtsev 2
  • chore(deps-dev): bump cryptography from 37.0.4 to 38.0.3

    chore(deps-dev): bump cryptography from 37.0.4 to 38.0.3

    Bumps cryptography from 37.0.4 to 38.0.3.

    Changelog

    Sourced from cryptography's changelog.

    38.0.3 - 2022-11-01

    
    * Updated Windows, macOS, and Linux wheels to be compiled with OpenSSL 3.0.7,
      which resolves *CVE-2022-3602* and *CVE-2022-3786*.
    

    .. _v38-0-2:

    38.0.2 - 2022-10-11 (YANKED)

    .. attention::

    This release was subsequently yanked from PyPI due to a regression in OpenSSL.
    
    • Updated Windows, macOS, and Linux wheels to be compiled with OpenSSL 3.0.6.

    .. _v38-0-1:

    38.0.1 - 2022-09-07

    
    * Fixed parsing TLVs in ASN.1 with length greater than 65535 bytes (typically
      seen in large CRLs).
    

    .. _v38-0-0:

    38.0.0 - 2022-09-06

    • Final deprecation of OpenSSL 1.1.0. The next release of cryptography will drop support.
    • We no longer ship manylinux2010 wheels. Users should upgrade to the latest pip to ensure this doesn't cause issues downloading wheels on their platform. We now ship manylinux_2_28 wheels for users on new enough platforms.
    • Updated the minimum supported Rust version (MSRV) to 1.48.0, from 1.41.0. Users with the latest pip will typically get a wheel and not need Rust installed, but check :doc:/installation for documentation on installing a newer rustc if required.
    • :meth:~cryptography.fernet.Fernet.decrypt and related methods now accept both str and bytes tokens.
    • Parsing CertificateSigningRequest restores the behavior of enforcing that the Extension critical field must be correctly encoded DER. See the issue <https://github.com/pyca/cryptography/issues/6368>_ for complete details.
    • Added two new OpenSSL functions to the bindings to support an upcoming pyOpenSSL release.
    • When parsing :class:~cryptography.x509.CertificateRevocationList and

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Problem with long enums

    Problem with long enums

    I noticed that aerich handles enums strangely. Instead of creating them as ENUM field in the table, a VARCHAR(length of the longest field in the enum) is used and the intended values are stored as a commetar at the field.

    However, this currently leads to problems for me, I have relatively many entries in an enum, which is why I get an error when I try to execute the migration.

    pymysql.err.OperationalError: (1629, "Comment for field 'type' is too long (max = 1024)")

    My workaround is to remove the comment field from the migration. However, this is a bit annoying in the long run, because aerich tries to add the comment every time I create a new migration.

    Is there any plan to support enum fields in the database as well?

    opened by l1f 0
  • Release fix for closing database connections on `aerich init-db`

    Release fix for closing database connections on `aerich init-db`

    Hi!

    I saw that the #268 issue of not closing connections when using aerich init-db was fixed in PR #269 about 6 weeks ago, but has not been added to a release (v0.7.1 was released a couple of days before the fix was merged).

    Would it be possible to push a bugfix release with this change? It is significantly affecting multi-connection sqlite setups, where one connection locks the process and blocks the following ones from being created (can't use Ctrl+C KeyboardInterrupt either).

    I've made the fix manually on my local machine but it would have an impact on deployment.

    In any case, great work on this project! Super fond of it and tortoise-orm! Thanks!

    opened by nachomaiz 0
  • `aerich upgrade` on empty does not work in 0.7.1

    `aerich upgrade` on empty does not work in 0.7.1

    With version 0.6.3 I am able to clone my project, create an empty db, and then run poetry run aerich upgrade, and all works like it should: the aerich table gets created along with all the tables for my models.

    After updating to version 0.7.1, when I run that command on an empty db, I get this message: "No upgrade items found".

    Downgrading to 0.6.3 fixes the issue.

    opened by jes5e 0
Releases(v0.7.1)
Owner
Tortoise
Familiar asyncio ORM for python, built with relations in mind
Tortoise
Python 3.6+ Asyncio PostgreSQL query builder and model

windyquery - A non-blocking Python PostgreSQL query builder Windyquery is a non-blocking PostgreSQL query builder with Asyncio. Installation $ pip ins

67 Sep 01, 2022
The ormar package is an async mini ORM for Python, with support for Postgres, MySQL, and SQLite.

python async mini orm with fastapi in mind and pydantic validation

1.2k Jan 05, 2023
The Orator ORM provides a simple yet beautiful ActiveRecord implementation.

Orator The Orator ORM provides a simple yet beautiful ActiveRecord implementation. It is inspired by the database part of the Laravel framework, but l

Sébastien Eustace 1.4k Jan 01, 2023
An async ORM. 🗃

ORM The orm package is an async ORM for Python, with support for Postgres, MySQL, and SQLite. ORM is built with: SQLAlchemy core for query building. d

Encode 1.7k Dec 28, 2022
Bringing Async Capabilities to django ORM

Bringing Async Capabilities to django ORM

Skander BM 119 Dec 01, 2022
Rich Python data types for Redis

Created by Stephen McDonald Introduction HOT Redis is a wrapper library for the redis-py client. Rather than calling the Redis commands directly from

Stephen McDonald 281 Nov 10, 2022
Adds SQLAlchemy support to Flask

Flask-SQLAlchemy Flask-SQLAlchemy is an extension for Flask that adds support for SQLAlchemy to your application. It aims to simplify using SQLAlchemy

The Pallets Projects 3.9k Jan 09, 2023
MongoEngine flask extension with WTF model forms support

Flask-MongoEngine Info: MongoEngine for Flask web applications. Repository: https://github.com/MongoEngine/flask-mongoengine About Flask-MongoEngine i

MongoEngine 815 Jan 03, 2023
Sqlalchemy-databricks - SQLAlchemy dialect for Databricks

sqlalchemy-databricks A SQLAlchemy Dialect for Databricks using the officially s

Flynn 19 Nov 03, 2022
Prisma Client Python is an auto-generated and fully type-safe database client

Prisma Client Python is an unofficial implementation of Prisma which is a next-generation ORM that comes bundled with tools, such as Prisma Migrate, which make working with databases as easy as possi

Robert Craigie 930 Jan 08, 2023
A dataclasses-based ORM framework

dcorm A dataclasses-based ORM framework. [WIP] - Work in progress This framework is currently under development. A first release will be announced in

HOMEINFO - Digitale Informationssysteme GmbH 1 Dec 24, 2021
Global base classes for Pyramid SQLAlchemy applications.

pyramid_basemodel pyramid_basemodel is a thin, low level package that provides an SQLAlchemy declarative Base and a thread local scoped Session that c

Grzegorz Śliwiński 15 Jan 03, 2023
A single model for shaping, creating, accessing, storing data within a Database

'db' within pydantic - A single model for shaping, creating, accessing, storing data within a Database Key Features Integrated Redis Caching Support A

Joshua Jamison 178 Dec 16, 2022
A new ORM for Python specially for PostgreSQL

A new ORM for Python specially for PostgreSQL. Fully-typed for any query with Pydantic and auto-model generation, compatible with any sync or async driver

Yan Kurbatov 3 Apr 13, 2022
A curated list of awesome tools for SQLAlchemy

Awesome SQLAlchemy A curated list of awesome extra libraries and resources for SQLAlchemy. Inspired by awesome-python. (See also other awesome lists!)

Hong Minhee (洪 民憙) 2.5k Dec 31, 2022
Tortoise ORM is an easy-to-use asyncio ORM inspired by Django.

Tortoise ORM was build with relations in mind and admiration for the excellent and popular Django ORM. It's engraved in it's design that you are working not with just tables, you work with relational

Tortoise 3.3k Jan 07, 2023
A pure Python Database Abstraction Layer

pyDAL pyDAL is a pure Python Database Abstraction Layer. It dynamically generates the SQL/noSQL in realtime using the specified dialect for the databa

440 Nov 13, 2022
Easy-to-use data handling for SQL data stores with support for implicit table creation, bulk loading, and transactions.

dataset: databases for lazy people In short, dataset makes reading and writing data in databases as simple as reading and writing JSON files. Read the

Friedrich Lindenberg 4.2k Dec 26, 2022
Object mapper for Amazon's DynamoDB

Flywheel Build: Documentation: http://flywheel.readthedocs.org/ Downloads: http://pypi.python.org/pypi/flywheel Source: https://github.com/stevearc/fl

Steven Arcangeli 128 Dec 31, 2022
Python helpers for using SQLAlchemy with Tornado.

tornado-sqlalchemy Python helpers for using SQLAlchemy with Tornado. Installation $ pip install tornado-sqlalchemy In case you prefer installing from

Siddhant Goel 122 Aug 23, 2022