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
fastapi-admin is a fast admin dashboard based on FastAPI and TortoiseORM with tabler ui, inspired by Django admin.

fastapi-admin is a fast admin dashboard based on FastAPI and TortoiseORM with tabler ui, inspired by Django admin.

fastapi-admin 1.6k Dec 30, 2022
SQLAlchemy database migrations for Flask applications using Alembic

Flask-Migrate Flask-Migrate is an extension that handles SQLAlchemy database migrations for Flask applications using Alembic. The database operations

Miguel Grinberg 2.2k Dec 28, 2022
CLI tool for typescript tasks & migrations

typed CLI tool for typescript tasks & migrations Installation Usage $ typed --list Subcommands: bootstrap ?? Bootstrap your environment for TypeS

Lob 1 Nov 15, 2021
FastAPI framework, high performance, easy to learn, fast to code, ready for production

FastAPI framework, high performance, easy to learn, fast to code, ready for production Documentation: https://fastapi.tiangolo.com Source Code: https:

Sebastián Ramírez 53k Jan 2, 2023
FastAPI framework, high performance, easy to learn, fast to code, ready for production

FastAPI framework, high performance, easy to learn, fast to code, ready for production Documentation: https://fastapi.tiangolo.com Source Code: https:

Sebastián Ramírez 53.1k Jan 6, 2023
Torchserve server using a YoloV5 model running on docker with GPU and static batch inference to perform production ready inference.

Yolov5 running on TorchServe (GPU compatible) ! This is a dockerfile to run TorchServe for Yolo v5 object detection model. (TorchServe (PyTorch librar

null 82 Nov 29, 2022
Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly.

Cookiecutter Django Powered by Cookiecutter, Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly. Documentati

Daniel Feldroy 10k Dec 31, 2022
FastAPI Skeleton App to serve machine learning models production-ready.

FastAPI Model Server Skeleton Serving machine learning models production-ready, fast, easy and secure powered by the great FastAPI by Sebastián Ramíre

null 268 Jan 1, 2023
A minimalist production ready plugin system

pluggy - A minimalist production ready plugin system This is the core framework used by the pytest, tox, and devpi projects. Please read the docs to l

pytest-dev 876 Jan 5, 2023
FastAPI Skeleton App to serve machine learning models production-ready.

FastAPI Model Server Skeleton Serving machine learning models production-ready, fast, easy and secure powered by the great FastAPI by Sebastián Ramíre

null 268 Jan 1, 2023
✨Rubrix is a production-ready Python framework for exploring, annotating, and managing data in NLP projects.

✨A Python framework to explore, label, and monitor data for NLP projects

Recognai 1.5k Jan 2, 2023
A production-ready pipeline for text mining and subject indexing

A production-ready pipeline for text mining and subject indexing

UF Open Source Club 12 Nov 6, 2022
Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly.

Cookiecutter Django Powered by Cookiecutter, Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly. Documentati

Daniel Roy Greenfeld 10k Jan 1, 2023
Write maintainable, production-ready pipelines using Jupyter or your favorite text editor. Develop locally, deploy to the cloud. ☁️

Write maintainable, production-ready pipelines using Jupyter or your favorite text editor. Develop locally, deploy to the cloud. ☁️

Ploomber 2.9k Jan 6, 2023
apple's universal binaries BUT MUCH WORSE (PRACTICAL SHITPOST) (NOT PRODUCTION READY)

hyperuniversality investment opportunity: what if we could run multiple architectures in a single file, again apple universal binaries, but worse how

luna 2 Oct 19, 2021
Combine the power of FastAPI and Django to build a production-ready application capable of utilizing all of the best features of both worlds.

FastAPI and Django Combo This projects aims to combine FastAPI and Django to build a Production ready application capable of utilizing all of the feat

Nsikak Imoh 33 Dec 27, 2022
Contra is a lightweight, production ready Tensorflow alternative for solving time series prediction challenges with AI

Contra AI Engine A lightweight, production ready Tensorflow alternative developed by Styvio styvio.com » How to Use · Report Bug · Request Feature Tab

styvio 14 May 25, 2022
Simpliest django(uvicorn)+postgresql+nginx docker-compose (ready for production and dev)

simpliest django(uvicorn)+postgresql+nginx docker-compose (ready for production and dev) To run in production: docker-compose up -d Site available on

Artyom Lisovskii 1 Dec 16, 2021
It takes time to start a Django Project and make it almost production-ready.

It takes time to start a Django Project and make it almost production-ready. A developer needs to spend a lot of time installing required libraries, setup a database, setup cache as well as hiding secrets, configuring `settings` files. With the help of django-setup-cli a developer can start an `almost production ready` project in a minute.

Khan Asfi Reza 1 Jan 1, 2022