GithubHelp home page GithubHelp logo

Comments (12)

codefather-labs avatar codefather-labs commented on August 26, 2024

My model metaclass example:

class Meta:
   table = 'TelegramApplication'
   default_connection = Database.telegram.name

from aerich.

codefather-labs avatar codefather-labs commented on August 26, 2024
class Database(Enum):
    telegram = "postgres://{}:{}@{}:{}/{}".format(
        os.environ.get("DB_USER"),
        os.environ.get("DB_PASS"),
        os.environ.get("DB_HOST"),
        os.environ.get("DB_PORT"),
        os.environ.get("DB_NAME")
    )

from aerich.

long2ice avatar long2ice commented on August 26, 2024

OK, I fixed in 881f70f, you can install from github and give it a try.

from aerich.

long2ice avatar long2ice commented on August 26, 2024

Just run pip install -e git+https://github.com/long2ice/aerich.git@dev#egg=aerich

from aerich.

codefather-labs avatar codefather-labs commented on August 26, 2024

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

from aerich.

codefather-labs avatar codefather-labs commented on August 26, 2024

aerich, version 0.1.9

aerich migrate

Traceback (most recent call last):
File "/usr/local/bin/aerich", line 11, in
load_entry_point('aerich', 'console_scripts', 'aerich')()
File "/app/src/aerich/aerich/cli.py", line 229, 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 "/app/src/aerich/aerich/cli.py", line 65, in cli
await Migrate.init_with_old_models(tortoise_config, app, location)
File "/app/src/aerich/aerich/migrate.py", line 53, in init_with_old_models
migrate_config = cls._get_migrate_config(config, app, location)
File "/app/src/aerich/aerich/migrate.py", line 179, in _get_migrate_config
"default_connection": config.get("apps").get(app).get("default_connection","default"),
AttributeError: 'NoneType' object has no attribute 'get'

from aerich.

codefather-labs avatar codefather-labs commented on August 26, 2024

i can show my code repo

https://bitbucket.org/codefather-hub/telegram-cms/src/master/docker/services/Dockerfile
https://bitbucket.org/codefather-hub/telegram-cms/src/master/docker/tools/migrate.py

https://bitbucket.org/codefather-hub/telegram-cms/src/master/services/core/models.py
https://bitbucket.org/codefather-hub/telegram-cms/src/master/services/feed/models.py
https://bitbucket.org/codefather-hub/telegram-cms/src/master/services/telegram/models.py

from aerich.

codefather-labs avatar codefather-labs commented on August 26, 2024

it can connect to connection which not named 'default'? cuz i don't have 'default' connection

from aerich.

long2ice avatar long2ice commented on August 26, 2024

You must specify --app=telegram

from aerich.

codefather-labs avatar codefather-labs commented on August 26, 2024

finally dev branch works for me

from aerich.

codefather-labs avatar codefather-labs commented on August 26, 2024
RUN mkdir vendor && cd vendor && git clone -b dev https://github.com/long2ice/aerich.git && \
    cd aerich && python3.8 setup.py install
RUN rm -rf vendor

RUN aerich --version

from aerich.

long2ice avatar long2ice commented on August 26, 2024

OK, nice to hear that.

from aerich.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.