-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
gh-118469: Add documentation for sqlite3 PEP-249 constructors #122091
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -424,6 +424,40 @@ Module functions | |
Note: *typename* and the name of the type in your query are matched | ||
case-insensitively. | ||
|
||
.. function:: Date(year, month, day) | ||
|
||
This function constructs an object holding a date value. | ||
|
||
.. function:: Time(hour, minute, second) | ||
|
||
This function constructs an object holding a time value. | ||
|
||
.. function:: Timestamp(year, month, day, hour, minute, second) | ||
|
||
This function constructs an object holding a time stamp value. | ||
|
||
.. function:: DateFromTicks(ticks) | ||
|
||
This function constructs an object holding a date value from the given ticks | ||
value (number of seconds since the epoch; see the documentation of the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume it's the UNIX epoch and not Gregorian epoch? Can it be a fractional number of seconds or not? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yeah the UNIX epoch.
This was taken from PEP-249. Should we get clarification there? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it was not considered at that time. In general, we don't change PEPs (unless there is a real issue with the PEP I think, but I am not aware of a precedent). Best is to ask @erlend-aasland: should we leave it imprecise, or is there some assumptions that I'm not aware of? |
||
standard Python :mod:`time` module for details). | ||
|
||
.. function:: TimeFromTicks(ticks) | ||
|
||
This function constructs an object holding a time value from the given ticks | ||
value (number of seconds since the epoch; see the documentation of the | ||
standard Python :mod:`time` module for details). | ||
|
||
.. function:: TimestampFromTicks(ticks) | ||
|
||
This function constructs an object holding a time stamp value from the given | ||
ticks value (number of seconds since the epoch; see the documentation of the | ||
standard Python :mod:`time` module for details). | ||
|
||
.. function:: Binary(string) | ||
|
||
This function constructs an object capable of holding a binary (long) string | ||
value. | ||
|
||
.. _sqlite3-module-constants: | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the second allowed to be fractional or not? (same question for
Time()
)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my tests, Doing something like this fails:
But this succeeds:
However, it is not mentioned in PEP-249. How should we handle that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh. I think should definitely be documented and the signature of
Time
should be something likeTime(h, m, s[, ms])
(check the syntax in the time module, I don't remember now).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha. Re-reading the issue, I believe the intention was to document these constructors per PEP-249. I'm not sure if this is more an implementation detail. Will wait for @erlend-aasland guidance.