Thank you so much for creating this video, it was extremely straightforward. As @Ali Hushman already pointed out there was the screen issue at 6:36 but altogether fantastic tutorial.
I appreciate you man, 🎉 Changing form sqlite to postgersql was super confusing for me, but you did it like it's nothing ! and after finishing the video I find out that you right, It wasn't that Hard😂
Thanks for this video. I deployed my Django app to Heroku with the sqlite3 database and my data started disappearing every hour or so. It was driving me crazy but finally I found the problem is with the database itself
Hey! Really useful video, but while importing data to new DB, an error occured in my case. The point is after I use "python manage.py migrate --run-syncdb" it creates all the tables and they are empty. Later the command "python manage.py loaddata datadump.json" gives an error "psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "django_content_type_app_label_model_76bd3d3b_uniq" DETAIL: Key (app_label, model)=(users, users) already exists."...
manage.py dumpdata --natural-foreign --natural-primary -e contenttypes -e auth.Permission --indent 4 You need to look into --natural-foreign --natural-primary ua-cam.com/video/CmWhiLclPHM/v-deo.html
Ah yes, that's what I feel like, Dead and gone. This tutorial should come with a warning. Ok so this error I would be 99.999% sure it is sure to primary key sequences in the tables. Have a look at this tutorials description - there is some better methods of making data dumps from Django - I would think knowing about --natural-foreign --natural-primary would solve it here. manage.py dumpdata --natural-foreign --natural-primary -e contenttypes -e auth.Permission --indent 4 ua-cam.com/video/CmWhiLclPHM/v-deo.html
Sorry can you help me I've been through this 6 times and can't get any tables to appear in postgresql althrough it says it has been successful. it does import all the permission tables but no others. Please tell me what i"m not doing it is getting desperate.
Yes Ali, sorry - great comment, I will make a GitHut repo - that was useless not actually showing the whole code. Did you manage to achieve what you set out to do?
Thanks man nice tutorial. The information is solid. Much appreciated. Although, I encountered an error while loading the dumpdata. The error was: Could not load contenttypes.ContentType(pk=2): duplicate key value violates unique constraint "django_content_type_app_label_model_76bd3d3b_uniq" DETAIL: Key (app_label, model)=(admin, logentry) already exists. So I did a quick search and found this command to make the initial dump which solves this error. ==> python manage.py dumpdata --exclude auth.permission --exclude contenttypes > datadump.json and then redid all the steps, worked fine for me then. Also the hidden line seems to be 'ENGINE': 'django.db.backends.postgresql_psycopg2'
Thank you Dinkar - this is really going to be useful for others in the same situation. This tutorial falls a bit short really when you consider the amount of issues and considerations when migrating data. I will collect all of this great info and eventually produce a much more in-depth tutorial 👍
Sir this was not for django actually.. I'm trying this stackoverflow.com/questions/53643254/unicodedecodeerror-utf-8-codec-cant-decode-byte-0xff-in-position-0
Hi there, I got this error when I tried to run the dump - (Unable to serialize database: fe_sendauth: no password supplied). However, please note that I just created my project (no app yet), ran 'python manage.py migrate' and I have not yet created the superuser yet. Is this the problem?
@@veryacademy Thanks - now resolved and my unfinished, but gradually progressing Django-React project, which I learned to do from your tutorials, is successfully on my postgres DB. Keep up the exceptionally great work you are doing, I am very grateful.
After I type in the command "python3 manage.oy loaddata datadump.json" I get this error 'Could not load contenttypes.ContentType(pk=12): UNIQUE constraint failed: django_content_type.app_label, django_content_type.model'
Sorry to hear you are having issues. Strange one, hard to help if there is no error. I suppose I can only suggest what you probably already have done, check code syntax, make sure you are selecting the right database and data file.
Hi Ujjwal - have a look at this see if this is useful ua-cam.com/video/CmWhiLclPHM/v-deo.html You may have a -natural-foreign --natural-primary issue 👍
Huge, respect for you 🙏, if was on ur postion, than I must delete, msg of saket Mukherjee, because he is giving link of his channel on urs, but you haven't done it. Respect from heart for you bro.
@@veryacademy But how to migrate data. I can see in datadump.json there are all the data. We also running 'loaddata' aren't we? What is the way to load data then. I got 'Installed 156 objects installed from 1 fixture'. But no data shows on pgadmin4 when I query (select * from table_name). any help is valuabe.
Thank you for the question. I need a little bit more information to help you here. Django version, Postgres version, what environment you are using, when do you get the error?. Else head over to stackoverflow.com/ the community can definitely help you there
Ok, thank you - well this is a completely different question now. First have a read of docs.aws.amazon.com/AmazonRDS/latest/UserGuide/PostgreSQL.Procedural.Importing.html
Hello, I experienced the same errors as well and was stuck for hours trying to fix it. My solution was to delete the values in the table "django_content_type" before you run loaddata. To do this, in pgadmin, right click on the table and select "Truncate Cascade". This will clear all values in the table. You might have to do the same for "auth_permission". After which loaddata should work. Hope this helps.
Im getting UnicodeDecodeError when i run command python manage.py loaddata datadump.json can you please help me how can i solve this issue. Thanks in advance
This error isn’t as straight forward to fix as you would like it to be. I recommend this link stackoverflow.com/questions/21129020/how-to-fix-unicodedecodeerror-ascii-codec-cant-decode-byte
finally a proper english and well planed instruction, thank you man
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'test',
'USER': 'postgres',
'PASSWORD': '1234',
'HOST': 'localhost',
'PORT': '5432',
}
}
the real heroes don wear capes
The hero we needed =)
thanks
Thank you so much for creating this video, it was extremely straightforward. As @Ali Hushman already pointed out there was the screen issue at 6:36 but altogether fantastic tutorial.
You're very welcome
Great Tutorial. Straight to the point, with proper instructions and visual input. :) Thanks for uploading
Thank you so much for making tutorial on this.There's no such tutorial like this on othet channe.Lots of love and support from me!
👍
I appreciate you man, 🎉
Changing form sqlite to postgersql was super confusing for me, but you did it like it's nothing ! and after finishing the video I find out that you right, It wasn't that Hard😂
Thanks for this video. I deployed my Django app to Heroku with the sqlite3 database and my data started disappearing every hour or so. It was driving me crazy but finally I found the problem is with the database itself
Same!
wanted to dump my data from sqlite from cpanel server and couldn't figure it out. This tutorial has solved all my worries. Thanks so much
Glad it helped! Thank you!
Thank you, the video was a great help to me
You're welcome!
Mate you are awesome
🐱🏍 if you watched this and understand - by your logic - you are awesome too!
thank you for all vids. may be record some about ci cd such as travis or jenkins. thank you again
Hey! Really useful video, but while importing data to new DB, an error occured in my case. The point is after I use "python manage.py migrate --run-syncdb" it creates all the tables and they are empty. Later the command "python manage.py loaddata datadump.json" gives an error "psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "django_content_type_app_label_model_76bd3d3b_uniq"
DETAIL: Key (app_label, model)=(users, users) already exists."...
manage.py dumpdata --natural-foreign --natural-primary -e contenttypes -e auth.Permission --indent 4
You need to look into --natural-foreign --natural-primary
ua-cam.com/video/CmWhiLclPHM/v-deo.html
thanks for the video, helpful
Glad it helped! Bit of an old one now.
Thanks! Very useful!
Thanks Sir, It helped me.
Thanks a lot for the video.
Cheers for the video but any idea why my loaddata didn't work? The error I get is Unique violation: duplicate key value violate unique contraint
Ah yes, that's what I feel like, Dead and gone. This tutorial should come with a warning. Ok so this error I would be 99.999% sure it is sure to primary key sequences in the tables. Have a look at this tutorials description - there is some better methods of making data dumps from Django - I would think knowing about --natural-foreign --natural-primary would solve it here.
manage.py dumpdata --natural-foreign --natural-primary -e contenttypes -e auth.Permission --indent 4
ua-cam.com/video/CmWhiLclPHM/v-deo.html
@@veryacademy haha I got it from the song back in 2012 🤣
I’ll have a look into that tomorrow, cheers!
@@veryacademy awesome video! That looks like it’ll help my problem 😁
Thank you very much!
Thanks a lot dude. Even for ubuntu similar.
You're welcome!
Thank you very much! Its very helpful video. I did it!
Great to hear it! Thank you!
it's funny how you say 'Google' when you're actually on Bing. Great tutorial btw.
Thank you. Great tutorial. What files can I now delete? Can I delete the sqlite3 file?
Yes you can now delete that file, but remember to back up! No idea, you might be working on a production DB! 😂
Sorry can you help me I've been through this 6 times and can't get any tables to appear in postgresql althrough it says it has been successful. it does import all the permission tables but no others. Please tell me what i"m not doing it is getting desperate.
Sorry, Joshua, I can't help you will this problem. Not knowing any details, start small. Go through the process with test data first.
6:36 man their are people watching your screen we need to see it as well,
is the engine' : 'django.db.backends.postgresql_psycopg2.extensions
Yes Ali, sorry - great comment, I will make a GitHut repo - that was useless not actually showing the whole code. Did you manage to achieve what you set out to do?
@@veryacademy well, no because the pgadmin get frozen and I got too many errors.... I will try tomorrow
thanks for this video
Most welcome
Great video!
before we migrate, we don't populate the sqlite DB ?
Not normally - you need a database structure to put data into
@@veryacademy thanks ! great content !
Thanks man nice tutorial. The information is solid. Much appreciated.
Although, I encountered an error while loading the dumpdata. The error was:
Could not load contenttypes.ContentType(pk=2): duplicate key value violates unique constraint "django_content_type_app_label_model_76bd3d3b_uniq"
DETAIL: Key (app_label, model)=(admin, logentry) already exists.
So I did a quick search and found this command to make the initial dump which solves this error.
==> python manage.py dumpdata --exclude auth.permission --exclude contenttypes > datadump.json
and then redid all the steps, worked fine for me then.
Also the hidden line seems to be 'ENGINE': 'django.db.backends.postgresql_psycopg2'
Thank you Dinkar - this is really going to be useful for others in the same situation. This tutorial falls a bit short really when you consider the amount of issues and considerations when migrating data. I will collect all of this great info and eventually produce a much more in-depth tutorial 👍
i was faceing the same ...and finaaly got a video on a new channel lol
ua-cam.com/video/RBtEr3TXNwg/v-deo.html
thank you so much for hidden line
Thaaannnnkk youuuuu
👍
In my case... When j use loaddata... It's showing that UnicodeDecoderError : 'utf-8' code can't decode byte 0xff in position 0 : invalid start byte
stackoverflow.com/questions/42339876/error-unicodedecodeerror-utf-8-codec-cant-decode-byte-0xff-in-position-0-in
Sir this was not for django actually.. I'm trying this stackoverflow.com/questions/53643254/unicodedecodeerror-utf-8-codec-cant-decode-byte-0xff-in-position-0
But also not working
I am also facing same problem , any solution yet?
@@ujjwalsrivastava9924 ya... I have one.. Wait ua-cam.com/video/RBtEr3TXNwg/v-deo.html...chek this
Hi there, I got this error when I tried to run the dump - (Unable to serialize database: fe_sendauth: no password supplied). However, please note that I just created my project (no app yet), ran 'python manage.py migrate' and I have not yet created the superuser yet. Is this the problem?
In your settings make sure you have defined the password parameter correctly - for example you must use capitals.
@@veryacademy Thanks - now resolved and my unfinished, but gradually progressing Django-React project, which I learned to do from your tutorials, is successfully on my postgres DB. Keep up the exceptionally great work you are doing, I am very grateful.
After I type in the command "python3 manage.oy loaddata datadump.json" I get this error 'Could not load contenttypes.ContentType(pk=12): UNIQUE constraint failed: django_content_type.app_label, django_content_type.model'
Did you solve it?
shows Installed 156 objects from 1 fixture. but the there is no data when I query using (select * from table_name ). Any help is valuabe.
Hi Amiay, it is difficult to help you here without knowing everything that you are doing.
I made it work, pgloader makes things easier
Hi, i want to push data into tables I've created in pgadmin instead of django creating new tables. How do I do this
Hi Deepthi, would this get you any closer ua-cam.com/video/CmWhiLclPHM/v-deo.html
i tried just like you but load data don't work anything.No error just not working .
Sorry to hear you are having issues. Strange one, hard to help if there is no error. I suppose I can only suggest what you probably already have done, check code syntax, make sure you are selecting the right database and data file.
Hey I am getting error like , unicodedecodeerror after "loaddata datadump.json" command
Hi Ujjwal - have a look at this see if this is useful
ua-cam.com/video/CmWhiLclPHM/v-deo.html You may have a -natural-foreign --natural-primary issue 👍
Huge, respect for you 🙏, if was on ur postion, than I must delete, msg of saket Mukherjee, because he is giving link of his channel on urs, but you haven't done it.
Respect from heart for you bro.
I am not able to dump my data to postgres, it say cannot read json file
I don't see a pgadmin for Ubuntu Linux...?
computingforgeeks.com/how-to-install-pgadmin-4-on-ubuntu/
Facing "Type mismatch" issue because all attributes are converted to text only
My database is migrated. But no records are inserted.
Sorry sir this is showing you how to migrate the database and not the data.
@@veryacademy But how to migrate data. I can see in datadump.json there are all the data. We also running 'loaddata' aren't we? What is the way to load data then. I got 'Installed 156 objects installed from 1 fixture'. But no data shows on pgadmin4 when I query (select * from table_name). any help is valuabe.
@@amiaynarayan516 same issue
Hello! In my case the table "core_core" did not appear, does anyone have or had this problem?
Postgres to mysql any suggestion sir..?
opendbcopy.sourceforge.net/
Im getting content type errors while pushing my datadump to postgres. please help me
Thank you for the question. I need a little bit more information to help you here. Django version, Postgres version, what environment you are using, when do you get the error?. Else head over to stackoverflow.com/ the community can definitely help you there
@@veryacademy I'm using Django version 3.0.6 and postgresql v12. I tried to sync my sqlite db with postgres hosted on aws
Ok, thank you - well this is a completely different question now. First have a read of docs.aws.amazon.com/AmazonRDS/latest/UserGuide/PostgreSQL.Procedural.Importing.html
Can you copy the full error message please
Hello, I experienced the same errors as well and was stuck for hours trying to fix it. My solution was to delete the values in the table "django_content_type" before you run loaddata. To do this, in pgadmin, right click on the table and select "Truncate Cascade". This will clear all values in the table. You might have to do the same for "auth_permission". After which loaddata should work. Hope this helps.
Im getting UnicodeDecodeError when i run command
python manage.py loaddata datadump.json
can you please help me how can i solve this issue.
Thanks in advance
This error isn’t as straight forward to fix as you would like it to be. I recommend this link stackoverflow.com/questions/21129020/how-to-fix-unicodedecodeerror-ascii-codec-cant-decode-byte
@@veryacademy This should get it correct: chcp 65001
set PYTHONIOENCODING=utf-8