Hi I encounter same problem as your, do you already got the solution? Any help will be appreciated, thank you~
On Saturday, November 14, 2015 at 1:40:21 AM UTC+7, [email protected] wrote: > > Hello. > I've got the same model in two projects and want to copy data from one to > another using model meta 'db_table' option: > > > my_model_original_table_name = MyModel._meta.db_table > MyModel._meta.db_table = 'old_project_table_name' > > old_objects = MyModel.objects.using('old_project_data_base').values('name') > old_objects = list(old_objects) > > MyModel._meta.db_table = my_model_original_table_name > > for old_object in old_objects: > new_object, created = > MyModel.objects.update_or_create(name=old_object['name']) > > > Old data retrieving works great, but when i try to execute last statement > i get: > "django.db.utils.ProgrammingError: missing FROM-clause entry for table > "old_project_table_name"" > > I tied to fetch data at the last stage instead of updating/creating > (MyModel.objects.all()) and get the same error. > The sql-query created by ORM is: > SELECT "old_project_table_name"."name" FROM "new_project_table_name" > > Why is it so? > > I am using django 1.8.6 and PostgreSQL 9.4.5 > Django 1.7.* work fine. > > > Thanks! > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0b3e71a1-ac34-459b-a2b0-32086492077d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

