jason weaver wrote:
> "jason weaver" <[EMAIL PROTECTED]> wrote:
> news:[EMAIL PROTECTED]
>>> However, due to database locking issues, I need to do a bunch of
>>> inserts in one transaction or batch. Thus, I store them in a simple
>>> queue. Therefore, the julianday('now') won't work because all of my
>>> batch inserts will have the same date and time. And that doesn't
>>> work very well. ;)
>
>> From: "Igor Tandetnik" <[EMAIL PROTECTED]>
>> You will have to deal with this in any case. E.g. on Windows the system
>> timer resolution is 15ms by default. You can insert quite a few records
>> in 15 ms.
>> It is unrealistic to expect that every record could be inserted with a
>> unique timestamp. Find some other way to ensure uniqueness (e.g. just
>> assign a sequential number to each).
>
>
> Thanks for your response. However, my batch inserts and the uniqueness of
> my timestamps aren't the issue. I guess I didn't explain my situation well
> enough. Let me try again.
>
>
>
> I take readings every X seconds which gives me plenty of uniqueness for each
> reading. I save the SQL statements and then insert them in small batches.
> However, from reading this newsgroup I've learned that the correct way to
> put dates into SQLite is as I described before:
>
> - create table my_table(date_stuff real);
>
> - insert into my_table values(julianday('now'));
>
> In my batch loop, I can't use julianday("now") - I need the timestamp
> to reflect when I took the reading.
>
>
>
> If the right way to put datetime in the dbase is the julianday('now')
> format, I need to be able to create and capture that format in python.
>
>
>
> What is the julianday("now") equivalent in python? I can't find a simple,
> straight-forward answer to this question.
>
>
>
> Thank you,
>
> Chris
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
In your case you can just lift the code from the Sqlite date and time
routines and include it in your application to get the correct time as a
REAL. Alternatively you can store the timestamp in some other way, say
in ISO format and use the Sqlite functions to convert it to an Sqlite
type timestamp when you insert.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users