Open jetxr opened 1 year ago
Okay, the binary is simply called migrate
. Can't get the migrations to run though, it just silently exits with no output.
Tried to pass the module with the --module
switch, but it fails with an ModuleNotFoundError: No module named 'source'
error
Hi thanks for checking out the library - the (definitely recommended, definitely easiest) way to do migrations is with the Migrator.run()
from within a script.
There is the migrate.py
file but I don't have any experience using it and didn't actually know it existed until now - I'll check it out to see but if you don't have to use CLI - I'd highly recommend the Migrator.run()
command.
Hi All,
I am facing the below error when I am trying to run migrations on a remote redis server. Here is the error, please help me out.
ERROR: Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 645, in lifespan async with self.lifespan_context(app): File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 540, in aenter await self._router.startup() File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 622, in startup await handler() File "/usr/share/pyscripts/ServerApi/./serverapi.py", line 48, in startup_event Migrator(redis).run() File "/usr/local/lib/python3.10/site-packages/redis_om/model/migrations/migrator.py", line 163, in run self.detect_migrations() File "/usr/local/lib/python3.10/site-packages/redis_om/model/migrations/migrator.py", line 101, in detect_migrations import_submodules(self.module) File "/usr/local/lib/python3.10/site-packages/redis_om/model/migrations/migrator.py", line 25, in import_submodules root_module = importlib.import_module(root_module_name) File "/usr/local/lib/python3.10/importlib/init.py", line 117, in import_module if name.startswith('.'): AttributeError: 'Redis' object has no attribute 'startswith'
@chakri622 without more info I can't give a concrete answer, but two things that stand out.
Migrator().run()
name
as a Redis object, and it's therefore not a string, and you can't do string operations on it@sav-norem What about when you have more than one redis instance? DB + Cache Does Migrator know which one to index?
There isn't any concrete documentation on Migrator tool. Its very much a black box.
The docs refer to running migrations with CLI. What's the command to run the migrate from CLI?