Code Monkey home page Code Monkey logo

Comments (8)

Blackmoomba avatar Blackmoomba commented on May 28, 2024 1

Thanks. I'll test the change tomorrow and let you know if everything appears to be working.

from marmot.

maxpert avatar maxpert commented on May 28, 2024

Thanks for reporting this, and I believe you might be right this might be combination of driver, and what gets serialized back. While I dig deeper to reproduce it, what was surprising to me is if the date time is being stored as a string. Can you kindly tell me what Python library + ORM are you using. As far as data loss, I won't label it as you have lost your data because these timestamps are sitting as UNIX timestamps. Nevertheless it's a quick Google told me:

SQLite does not have an official datetime type. Instead, it stores dates and times as TEXT, REAL or INTEGER values using Date and Time Functions. TEXT as ISO8601 strings (“YYYY-MM-DD HH:MM:SS. SSS”).
https://tableplus.com/blog/2018/07/sqlite-how-to-use-datetime-value.html#:~:text=SQLite%20does%20not%20have%20an,SSS%E2%80%9D).

Now question for me is to see if I can detect if it's string or integer or real. With how driver is converting it under the hood, it might be challenging.

from marmot.

Blackmoomba avatar Blackmoomba commented on May 28, 2024

You're correct that the data is not lost - just unexpectedly transformed, which caused quite a bit of troubleshooting on my end.

With that said, I'm using python's standard sqlite3 library. I'm inserting into the sql datetime fields via the datetime class's __str__() method, which returns an ISO8601 formatted string.

IE:

In [1]: from datetime import datetime, timezone

In [2]: dt = datetime.now(tz=timezone.utc)

In [3]: dt
Out[3]: datetime.datetime(2023, 8, 16, 20, 23, 18, 105371, tzinfo=datetime.timezone.utc)

In [4]: str(dt)
Out[4]: '2023-08-16 20:23:18.105371+00:00'   # <-- this is what I'm inserting to sqlite3 db as a param

from marmot.

maxpert avatar maxpert commented on May 28, 2024

Just to update, I am able to reproduce the issue. The code in Marmot is pretty straight forward and I am trying to see if I can monkey patch something to unblock you. So far dead-ends I will post once I land something.

from marmot.

maxpert avatar maxpert commented on May 28, 2024

Update 2: I've Identified the issue, will be working over it to get the fix out. Next version should have the fix in it.

from marmot.

maxpert avatar maxpert commented on May 28, 2024

@Blackmoomba I will release a beta version in a while, I've verified on my end that it works. Can you help me test that it works for you as well?

Here is before (first insert and select) and after (second insert after fix) that I am seeing:
image

from marmot.

Blackmoomba avatar Blackmoomba commented on May 28, 2024

This fixed the issue. Thanks very much for resolving this so quickly.

from marmot.

maxpert avatar maxpert commented on May 28, 2024

Prefect I will wait for a few days for you to double check and close the ticket.

from marmot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.