Django PostgreSQL Migration from SQLite

Поділитися
Вставка
  • Опубліковано 13 гру 2024

КОМЕНТАРІ • 105

  • @gamefreak7347
    @gamefreak7347 6 місяців тому

    finally a proper english and well planed instruction, thank you man

  • @asadabbas6827
    @asadabbas6827 3 роки тому +14

    DATABASES = {
    'default': {
    'ENGINE': 'django.db.backends.postgresql_psycopg2',
    'NAME': 'test',
    'USER': 'postgres',
    'PASSWORD': '1234',
    'HOST': 'localhost',
    'PORT': '5432',
    }
    }

  • @justicepeltier9001
    @justicepeltier9001 4 роки тому +3

    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.

  • @sherlockstark1706
    @sherlockstark1706 3 роки тому +1

    Great Tutorial. Straight to the point, with proper instructions and visual input. :) Thanks for uploading

  • @sunilshrestha9576
    @sunilshrestha9576 3 роки тому +1

    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!

  • @animealc4489
    @animealc4489 Рік тому

    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😂

  • @titan8788
    @titan8788 3 роки тому +4

    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

  • @danielnjama1470
    @danielnjama1470 4 роки тому +1

    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

  • @ivanlegranbizarro8102
    @ivanlegranbizarro8102 3 роки тому +1

    Thank you, the video was a great help to me

  • @patrickknows2296
    @patrickknows2296 3 роки тому +1

    Mate you are awesome

    • @veryacademy
      @veryacademy  3 роки тому

      🐱‍🏍 if you watched this and understand - by your logic - you are awesome too!

  • @javadamanian1806
    @javadamanian1806 3 роки тому

    thank you for all vids. may be record some about ci cd such as travis or jenkins. thank you again

  • @СтаниславСучков-щ8о

    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."...

    • @veryacademy
      @veryacademy  4 роки тому +2

      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

  • @nickng8069
    @nickng8069 3 роки тому +1

    thanks for the video, helpful

    • @veryacademy
      @veryacademy  3 роки тому

      Glad it helped! Bit of an old one now.

  • @yuriidezhniuk4521
    @yuriidezhniuk4521 2 роки тому

    Thanks! Very useful!

  • @baburamchaudhary159
    @baburamchaudhary159 3 роки тому

    Thanks Sir, It helped me.

  • @ricardocambundo2527
    @ricardocambundo2527 3 роки тому

    Thanks a lot for the video.

  • @deadandgone70
    @deadandgone70 4 роки тому +3

    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

    • @veryacademy
      @veryacademy  4 роки тому +2

      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

    • @deadandgone70
      @deadandgone70 4 роки тому

      @@veryacademy haha I got it from the song back in 2012 🤣
      I’ll have a look into that tomorrow, cheers!

    • @deadandgone70
      @deadandgone70 4 роки тому

      @@veryacademy awesome video! That looks like it’ll help my problem 😁

  • @fuadpalchayev7269
    @fuadpalchayev7269 2 роки тому

    Thank you very much!

  • @brandm5176
    @brandm5176 3 роки тому +1

    Thanks a lot dude. Even for ubuntu similar.

  • @deepchess8641
    @deepchess8641 4 роки тому

    Thank you very much! Its very helpful video. I did it!

  • @cajocz
    @cajocz 5 місяців тому

    it's funny how you say 'Google' when you're actually on Bing. Great tutorial btw.

  • @tlotlegomogapi2174
    @tlotlegomogapi2174 4 роки тому +1

    Thank you. Great tutorial. What files can I now delete? Can I delete the sqlite3 file?

    • @veryacademy
      @veryacademy  4 роки тому +2

      Yes you can now delete that file, but remember to back up! No idea, you might be working on a production DB! 😂

  • @jlumley
    @jlumley Рік тому +1

    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.

    • @veryacademy
      @veryacademy  Рік тому

      Sorry, Joshua, I can't help you will this problem. Not knowing any details, start small. Go through the process with test data first.

  • @alihusham1560
    @alihusham1560 4 роки тому +6

    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

    • @veryacademy
      @veryacademy  4 роки тому +1

      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?

    • @alihusham1560
      @alihusham1560 4 роки тому

      @@veryacademy well, no because the pgadmin get frozen and I got too many errors.... I will try tomorrow

  • @walidramdani3953
    @walidramdani3953 4 роки тому +1

    thanks for this video

  • @NoCSDegree
    @NoCSDegree 3 роки тому

    Great video!

  • @liorbm1
    @liorbm1 3 роки тому +1

    before we migrate, we don't populate the sqlite DB ?

    • @veryacademy
      @veryacademy  3 роки тому +1

      Not normally - you need a database structure to put data into

    • @liorbm1
      @liorbm1 3 роки тому

      @@veryacademy thanks ! great content !

  • @dinkarjain7489
    @dinkarjain7489 4 роки тому +2

    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'

    • @veryacademy
      @veryacademy  4 роки тому

      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 👍

    • @saikatmukherjee8095
      @saikatmukherjee8095 4 роки тому

      i was faceing the same ...and finaaly got a video on a new channel lol
      ua-cam.com/video/RBtEr3TXNwg/v-deo.html

    • @novartisnk9684
      @novartisnk9684 3 роки тому

      thank you so much for hidden line

  • @asmaboudjatat694
    @asmaboudjatat694 3 роки тому +1

    Thaaannnnkk youuuuu

  • @saikatmukherjee8095
    @saikatmukherjee8095 4 роки тому +2

    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

    • @veryacademy
      @veryacademy  4 роки тому

      stackoverflow.com/questions/42339876/error-unicodedecodeerror-utf-8-codec-cant-decode-byte-0xff-in-position-0-in

    • @saikatmukherjee8095
      @saikatmukherjee8095 4 роки тому

      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

    • @saikatmukherjee8095
      @saikatmukherjee8095 4 роки тому

      But also not working

    • @ujjwalsrivastava9924
      @ujjwalsrivastava9924 4 роки тому

      I am also facing same problem , any solution yet?

    • @saikatmukherjee8095
      @saikatmukherjee8095 4 роки тому +1

      @@ujjwalsrivastava9924 ya... I have one.. Wait ua-cam.com/video/RBtEr3TXNwg/v-deo.html...chek this

  • @larrymountain1914
    @larrymountain1914 4 роки тому +1

    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
      @veryacademy  4 роки тому

      In your settings make sure you have defined the password parameter correctly - for example you must use capitals.

    • @larrymountain1914
      @larrymountain1914 4 роки тому

      @@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.

  • @mannycestoni4479
    @mannycestoni4479 3 роки тому +1

    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'

  • @amiaynarayan516
    @amiaynarayan516 3 роки тому +1

    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.

    • @veryacademy
      @veryacademy  3 роки тому

      Hi Amiay, it is difficult to help you here without knowing everything that you are doing.

    • @amiaynarayan516
      @amiaynarayan516 3 роки тому

      I made it work, pgloader makes things easier

  • @deepthipisupati3576
    @deepthipisupati3576 4 роки тому +1

    Hi, i want to push data into tables I've created in pgadmin instead of django creating new tables. How do I do this

    • @veryacademy
      @veryacademy  4 роки тому +1

      Hi Deepthi, would this get you any closer ua-cam.com/video/CmWhiLclPHM/v-deo.html

  • @arifulkader4691
    @arifulkader4691 4 роки тому +2

    i tried just like you but load data don't work anything.No error just not working .

    • @veryacademy
      @veryacademy  4 роки тому

      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.

  • @ujjwalsrivastava9924
    @ujjwalsrivastava9924 4 роки тому +1

    Hey I am getting error like , unicodedecodeerror after "loaddata datadump.json" command

    • @veryacademy
      @veryacademy  4 роки тому +1

      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 👍

    • @ujjwalsrivastava9924
      @ujjwalsrivastava9924 4 роки тому

      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.

  • @Gokreative
    @Gokreative Рік тому

    I am not able to dump my data to postgres, it say cannot read json file

  • @matthewrosenberg949
    @matthewrosenberg949 3 роки тому +1

    I don't see a pgadmin for Ubuntu Linux...?

    • @veryacademy
      @veryacademy  3 роки тому

      computingforgeeks.com/how-to-install-pgadmin-4-on-ubuntu/

  • @sandeepsingh-zk3yj
    @sandeepsingh-zk3yj 8 днів тому

    Facing "Type mismatch" issue because all attributes are converted to text only

  • @ajinzrathod
    @ajinzrathod 3 роки тому +1

    My database is migrated. But no records are inserted.

    • @veryacademy
      @veryacademy  3 роки тому +1

      Sorry sir this is showing you how to migrate the database and not the data.

    • @amiaynarayan516
      @amiaynarayan516 3 роки тому +1

      @@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.

    • @sandeepsingh-zk3yj
      @sandeepsingh-zk3yj 8 днів тому

      @@amiaynarayan516 same issue

  • @mateolizatovich5441
    @mateolizatovich5441 2 роки тому

    Hello! In my case the table "core_core" did not appear, does anyone have or had this problem?

  • @nirpeshchaudhary3974
    @nirpeshchaudhary3974 4 роки тому

    Postgres to mysql any suggestion sir..?

  • @manikandanprabhakaran7516
    @manikandanprabhakaran7516 4 роки тому

    Im getting content type errors while pushing my datadump to postgres. please help me

    • @veryacademy
      @veryacademy  4 роки тому

      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

    • @manikandanprabhakaran7516
      @manikandanprabhakaran7516 4 роки тому

      @@veryacademy I'm using Django version 3.0.6 and postgresql v12. I tried to sync my sqlite db with postgres hosted on aws

    • @veryacademy
      @veryacademy  4 роки тому

      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

    • @veryacademy
      @veryacademy  4 роки тому

      Can you copy the full error message please

    • @iyej
      @iyej 4 роки тому

      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.

  • @unusualanonymous6744
    @unusualanonymous6744 4 роки тому

    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

    • @veryacademy
      @veryacademy  4 роки тому

      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

    • @661bahi
      @661bahi 4 роки тому

      @@veryacademy This should get it correct: chcp 65001
      set PYTHONIOENCODING=utf-8