Comments (12)
My model metaclass example:
class Meta:
table = 'TelegramApplication'
default_connection = Database.telegram.name
from aerich.
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.
OK, I fixed in 881f70f, you can install from github and give it a try.
from aerich.
Just run pip install -e git+https://github.com/long2ice/aerich.git@dev#egg=aerich
from aerich.
still got tortoise.exceptions.ConfigurationError: Unknown connection "default" for app "diff_models"
from aerich.
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.
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.
it can connect to connection which not named 'default'? cuz i don't have 'default' connection
from aerich.
You must specify --app=telegram
from aerich.
finally dev branch works for me
from aerich.
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.
OK, nice to hear that.
from aerich.
Related Issues (20)
- aerich inspectdb makes syntax error
- Pydantic validation error when inspecting DB HOT 4
- AttributeError: 'method_descriptor' object has no attribute '__module__'. Did you mean: '__reduce__'? HOT 1
- stuck on init HOT 13
- FK column rename error
- FK column unique not working
- migrate() got an unexpected keyword argument 'empty' HOT 2
- Model with multiple FKs to same table throws error or finds changes that aren't there
- Insert into a glossary table HOT 1
- Support altering columns in SQLite migrations by RENAME-ADD-UPDATE-DROP HOT 1
- Setting null = false on m2m fields causes migration to fail
- Multiple database HOT 2
- Migrate from `CharField(...,unique=True)` to `CharField(...,unique=False)` raises tortoise.exceptions.OperationalError HOT 1
- `make test_postgres` failed with `tortoise-orm>=0.21`
- UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 84: character maps to <undefined>
- Support 3.12.4
- Error reported when add and modify many to many relationships
- RuntimeWarning: Module "x.x.x" has no models HOT 1
- Version 0.7.2 DB configuration not initialised.
- aerich upgrade 'Failed to open the referenced table' problem in one-to-many HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aerich.