Skip to content

SQLite's strftime() doesn't work properly when run from Python 3.13.2 #131976

@deathnoise

Description

@deathnoise

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

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions