-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Closed as not planned
Closed as not planned
Copy link
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
I'm trying to run an UPDATE on SQLITE database from inside Python script.
The exact same, verbatim SQL update query works perfectly fine in DBeaver.
When I copy it to Python - it doesn't work.
The UPDATE puts NULL on every row where it should put a specific, formatted date.
It looks like SQLITE's strftime() function just doesn't work, properly.
Column "Date" in database contains (before running UPDATE) SQLITE-compatible timestamps like so:
1439416800
etc
After running following UPDATE - the value on every row, in column "Date" should contain the formatted date, like so:
09/30/23
...
etc
(month,day,year)
minimal code is similar to this:
import sqlite3
test = """
UPDATE bu2 set "Date" = strftime('%m/%d/%g', datetime("Date"), 'unixepoch');
"""
cxn = sqlite3.connect('base.db')
cxn.execute(test)
cxn.commit()
cxn.close()
CPython versions tested on:
3.13
Operating systems tested on:
Windows
Metadata
Metadata
Assignees
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error