#34492: I get an error when using BinaryField in sqllite3.
-------------------------------------+-------------------------------------
     Reporter:  Taikono-Himazin      |                    Owner:  nobody
         Type:  Uncategorized        |                   Status:  new
    Component:  Database layer       |                  Version:  3.2
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  BinaryField          |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by Taikono-Himazin:

Old description:

> I'm working with data in Blobs in sqlite. It is purely binary (like an
> image for example) and not information that can be converted to a string.
> When I get that data through django's model, I get the following error:
>

> {{{
>   File "\site-packages\django\db\models\query.py", line 674, in first
>     for obj in (self if self.ordered else self.order_by('pk'))[:1]:
>   File "\site-packages\django\db\models\query.py", line 280, in __iter__
>     self._fetch_all()
>   File "\site-packages\django\db\models\query.py", line 1324, in
> _fetch_all
>     self._result_cache = list(self._iterable_class(self))
>   File "\site-packages\django\db\models\query.py", line 51, in __iter__
>     results = compiler.execute_sql(chunked_fetch=self.chunked_fetch,
> chunk_size=self.chunk_size)
>   File "\site-packages\django\db\models\sql\compiler.py", line 1175, in
> execute_sql
>     cursor.execute(sql, params)
>   File "\site-packages\django\db\backends\utils.py", line 98, in execute
>     return super().execute(sql, params)
>   File "\site-packages\django\db\backends\utils.py", line 66, in execute
>     return self._execute_with_wrappers(sql, params, many=False,
> executor=self._execute)
>   File "\site-packages\django\db\backends\utils.py", line 75, in
> _execute_with_wrappers
>     return executor(sql, params, many, context)
>   File "\site-packages\django\db\backends\utils.py", line 84, in _execute
>     return self.cursor.execute(sql, params)
>   File "\site-packages\django\db\utils.py", line 90, in __exit__
>     raise dj_exc_value.with_traceback(traceback) from exc_value
>   File "\site-packages\django\db\backends\utils.py", line 84, in _execute
>     return self.cursor.execute(sql, params)
>   File "\site-packages\django\db\backends\sqlite3\base.py", line 423, in
> execute
>     return Database.Cursor.execute(self, query, params)
> django.db.utils.OperationalError: Could not decode to UTF-8 column
> 'msrepl_synctran_ts' with text ''
> }}}
>

> I researched quite a bit about this, but there wasn't much information on
> the internet.
> Please suggest me a workaround. I'm sorry I can't handle this with
> python.

New description:

 I'm working with data in Blobs in sqlite. It is purely binary (like an
 image for example) and not information that can be converted to a string.
 When I get that data through django's model, I get the following error:


 {{{
   File "\site-packages\django\db\models\query.py", line 674, in first
     for obj in (self if self.ordered else self.order_by('pk'))[:1]:
   File "\site-packages\django\db\models\query.py", line 280, in __iter__
     self._fetch_all()
   File "\site-packages\django\db\models\query.py", line 1324, in
 _fetch_all
     self._result_cache = list(self._iterable_class(self))
   File "\site-packages\django\db\models\query.py", line 51, in __iter__
     results = compiler.execute_sql(chunked_fetch=self.chunked_fetch,
 chunk_size=self.chunk_size)
   File "\site-packages\django\db\models\sql\compiler.py", line 1175, in
 execute_sql
     cursor.execute(sql, params)
   File "\site-packages\django\db\backends\utils.py", line 98, in execute
     return super().execute(sql, params)
   File "\site-packages\django\db\backends\utils.py", line 66, in execute
     return self._execute_with_wrappers(sql, params, many=False,
 executor=self._execute)
   File "\site-packages\django\db\backends\utils.py", line 75, in
 _execute_with_wrappers
     return executor(sql, params, many, context)
   File "\site-packages\django\db\backends\utils.py", line 84, in _execute
     return self.cursor.execute(sql, params)
   File "\site-packages\django\db\utils.py", line 90, in __exit__
     raise dj_exc_value.with_traceback(traceback) from exc_value
   File "\site-packages\django\db\backends\utils.py", line 84, in _execute
     return self.cursor.execute(sql, params)
   File "\site-packages\django\db\backends\sqlite3\base.py", line 423, in
 execute
     return Database.Cursor.execute(self, query, params)
 django.db.utils.OperationalError: Could not decode to UTF-8 column
 'msrepl_synctran_ts' with text ''
 }}}


 I researched quite a bit about this, but there wasn't much information on
 the internet.
 Please suggest me a workaround.
 I don't want the msrepl_synctran_ts data to be editable in django's model.

--

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34492#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701877e8ab0a1-f8e67a8e-98f7-4d01-b271-054297e67050-000000%40eu-central-1.amazonses.com.

Reply via email to