Hello,
I am not able to manage a database that I created earlier using Django. I’m using a SQLite3 database that I created using the Sqlitestudio application.
I configured my stettings.py as follows:
DATABASES = {
‘default’: {
‘ENGINE’: ‘django.db.backends.sqlite3’,
‘NAME’: os.path.join (BASE_DIR, ‘rrpm.db’),
}
}
I imported the DB using the “inspectdb” command as follows:
$ python manage.py inspectdb> gcee.models.py
Models.py was created correctly. However I cannot manipulate the DB using the django API, as it presents the following error:
from gcee.models import *
cliente = Clientes.objects.get(pk=1)
Traceback (most recent call last):
File “”, line 1, in
File “/media/ruben.bisneto@ricoli.local/DADOS/RR ENERGIA/SoftwareDB_RR/RR-PowerManager/Test/venv/lib/python3.6/site-packages/django/db/models/manager.py”, line 82, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File “/media/ruben.bisneto@ricoli.local/DADOS/RR ENERGIA/SoftwareDB_RR/RR-PowerManager/Test/venv/lib/python3.6/site-packages/django/db/models/query.py”, line 411, in get
num = len(clone)
File “/media/ruben.bisneto@ricoli.local/DADOS/RR ENERGIA/SoftwareDB_RR/RR-PowerManager/Test/venv/lib/python3.6/site-packages/django/db/models/query.py”, line 258, in len
self._fetch_all()
File “/media/ruben.bisneto@ricoli.local/DADOS/RR ENERGIA/SoftwareDB_RR/RR-PowerManager/Test/venv/lib/python3.6/site-packages/django/db/models/query.py”, line 1261, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File “/media/ruben.bisneto@ricoli.local/DADOS/RR ENERGIA/SoftwareDB_RR/RR-PowerManager/Test/venv/lib/python3.6/site-packages/django/db/models/query.py”, line 57, in iter
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
File “/media/ruben.bisneto@ricoli.local/DADOS/RR ENERGIA/SoftwareDB_RR/RR-PowerManager/Test/venv/lib/python3.6/site-packages/django/db/models/sql/compiler.py”, line 1151, in execute_sql
cursor.execute(sql, params)
File “/media/ruben.bisneto@ricoli.local/DADOS/RR ENERGIA/SoftwareDB_RR/RR-PowerManager/Test/venv/lib/python3.6/site-packages/django/db/backends/utils.py”, line 100, in execute
return super().execute(sql, params)
File “/media/ruben.bisneto@ricoli.local/DADOS/RR ENERGIA/SoftwareDB_RR/RR-PowerManager/Test/venv/lib/python3.6/site-packages/django/db/backends/utils.py”, line 68, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File “/media/ruben.bisneto@ricoli.local/DADOS/RR ENERGIA/SoftwareDB_RR/RR-PowerManager/Test/venv/lib/python3.6/site-packages/django/db/backends/utils.py”, line 77, in _execute_with_wrappers
return executor(sql, params, many, context)
File “/media/ruben.bisneto@ricoli.local/DADOS/RR ENERGIA/SoftwareDB_RR/RR-PowerManager/Test/venv/lib/python3.6/site-packages/django/db/backends/utils.py”, line 86, in _execute
return self.cursor.execute(sql, params)
File “/media/ruben.bisneto@ricoli.local/DADOS/RR ENERGIA/SoftwareDB_RR/RR-PowerManager/Test/venv/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py”, line 396, in execute
return Database.Cursor.execute(self, query, params)
File “/usr/lib/python3.6/sqlite3/dbapi2.py”, line 64, in convert_date
return datetime.date(*map(int, val.split(b"-")))
ValueError: invalid literal for int() with base 10: b’01/02/2018’
What is going on? What did I do wrong?