Getting error after changed sqlite to mysql, table doesn't exist? - mysql

i've finished developing a django project and wanted to change sqlite3 to MySql for a better database option. I tried in an empty project to change database, it worked like a charm. But now i changed db of my project and when i try to do python manage.py makemigrations it returns;
django.db.utils.ProgrammingError: (1146, "Table 'tvekstra-django-tracker.tvchannels_channels' doesn't exist")
Any help is appreciated, thanks.

I guess you have code that is trying to query the database before makemigrations runs. Here is a similar question. To help with your specific problem, you need to show the full traceback which will show where the query is occuring, and your views.py.

Related

Importing big sql file ends up with [ERROR_RDBMS] exit status 1

I'm trying to import a big sql file (around 10GB) in Google SQL. I have create my instance and had tried so far with MySQL 5.6 and MySQL 5.7 both getting the same issue when trying to import the database: [ERROR_RDBMS] exit status 1. I have tried the user interface method for import as well as the console one (gcloud sql import sql mydb gs://my-path/mydb.sql --database=mydb). Also tried to find more details in Log explorer, but there was no error or anything else be notices for the mysql.err log.
In the same time I manage to connect my MySQL Workbench to the instance and I could see that there where few database tables that were imported. The only import seems that crushed on importing one of the biggest tables which is around 5GB.
Can anyone suggest what might cause this error and how I can find more info about it. Thank you.
I didn't found how to see the error on google console but figure it our that I can import the database through the MySQL Workbench and there I got the full error. If any one know a way to do this on the google cloud I'll accept her/his answer.

MySQL does not import a .sql

I'm trying to import a .sql that I've downloaded. The thing is that when I click on continue, it gets in white page and does not import the database.
I've tried importing my code too in the option SQL but doesn't work either.
I get this error:
https://gyazo.com/a864ad63b66259235fb4d7493344fcd2
Here's a video I've recorded for you, so you will understand better.
https://www.youtube.com/watch?v=IZVtxzCMjm8
You need to select an existing database or need to create a database first. And then try to import.
Update
For the new error that you got, you can follow this.
phpMyAdmin Error in processing request Error code: 500 Error text: Internal Server Error
And also I suggest updating your xampp or wamp will also solve this problem.

MySQL Test DB Failing

I set up a Django 2 app (and Python 3.6) with a remote MySQL DB (using mysqlclient), with proper permissions.
When I run my unit test, I get the following error: django.db.utils.ProgrammingError: (1146, “Table ‘test_<db>.<db>’ doesn’t exist”).
When I manually open the website at localhost, everything works fine.
Technically I could create a local dev DB for testing, but I would prefer that the test DB is created automatically.
EDIT
It seems like the issue was related to my tables not being managed by Django, see here.
I believe this is a duplicate.
Django : Table doesn't exist
If the table is missing, make sure you've got the right migration file (python manage.py makemigrations) and that you've applied it (python manage.py migrate).
What worked for me:
Changing my tables to managed = True.
Deleting migration files (except __init__.py).
python manage.py makemigrations
python manage.py migrate
And now my unit tests are running.

PG::UndefinedTable: ERROR: relation 'caves' does not exist

I've ran into a problem in which I'm not sure how to get out of this. Working on creating a rails view, and after populating my view and editing my controller, i've ran into an error that states PG::UndefinedTable: ERROR: relation 'caves' does not exist
Looking into what I did, I realized that I created my model as cafe but when I populated my schema tables, I accidentally created a table called caves instead of cafes.
Here's what I did to try to resolve this.
I first tried creating a migration to just rename the table from caves to cafes -- still ran into the same error
I then tried deleting the schema table all together and creating a new one all together called cafe - still ran into the same error
I then tried dropping my database all together, thinking if I just wiped the whole thing and started over (i just started on this rails project). I ran rake db:reset only to come into a new error telling me ActiveRecord::StatementInvalid: PG::ObjectInUse: ERROR: database "cafe_database" is being accessed by other users
By this point, I tried restarted my postgress and ran sudo service postgresql restart....but my machine doesn't recognize service
Does anybody have an idea what I can do to figure this problem out? I'm running out of ideas.
try below steps:
1. rake db:drop
2. rake db:create
3. rake db:migrate

Django django_admin_log' doesn't exist

I have setup a new database with MySQL and run
python manage.py migrate
then run
python loaddata db.json
to load data from my previous sqlite database.
But now when I try to access the admin pages I get
ProgrammingError at /admin/
(1146, "Table 'myapp.django_admin_log' doesn't exist")
Other answers say to run syncdb but it not longer exists.
Any ideas?
Add django.contrib.admin in your INSTALLED_APPS, then run python manage.py migrate admin to create initial db tables for admin application. It will create django_admin_log table for you.