I am trying to migrate data from a node.js app to my django app, luckily they both use postgresql but I don't know how the access the node.js database and get the model, I have entered the second database in my settings.py but .get_model() cant take database name as an attribute only app name and model name, and since the app is in node.js I am running in a problem before even starting, is there a way to get the model directly from the node.js side database and what is the syntax ? this is my code so far:
class Migration(migrations.Migration):
def migrate_items(self, schema_editor):
old_item_model = self.get_model("inventory", "Item") # THIS NEEDS TO COME FROM THE NODE.JS SIDE DATABASE.
items = old_item_model.objects.using('inventory').all()
print(items)
def reverse_migrate_items(self, schema_editor):
pass
dependencies = [
('items', '0022_merge_0020_alter_history_event_0021_alter_assign_item'),
]
operations = [migrations.RunPython(migrate_items, reverse_code=reverse_migrate_items)
]
Thanks.