Opened 17 months ago

Closed 17 months ago

Last modified 17 months ago

#34492 closed Uncategorized (invalid)

I get an error when using BinaryField in sqllite3.

Reported by: Taikono-Himazin Owned by: nobody
Component: Database layer (models, ORM) Version: 3.2
Severity: Normal Keywords: BinaryField
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Taikono-Himazin)

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 need the msrepl_synctran_ts data to be visible/editable in the django model. I just want to load a model with a column called msrepl_synctran_ts.

Change History (4)

comment:1 by Taikono-Himazin, 17 months ago

Description: modified (diff)

comment:2 by Taikono-Himazin, 17 months ago

Description: modified (diff)

comment:3 by Mariusz Felisiak, 17 months ago

Resolution: invalid
Status: newclosed

Please don't use Trac as a support channel. Closing per TicketClosingReasons/UseSupportChannels. I'm happy to respond on support channels.

comment:4 by Taikono-Himazin, 17 months ago

Oh, I'm sorry.

Note: See TracTickets for help on using tickets.
Back to Top