[ 
https://issues.apache.org/jira/browse/CASSANDRA-18879?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17792226#comment-17792226
 ] 

Arun Ganesh edited comment on CASSANDRA-18879 at 12/1/23 10:32 PM:
-------------------------------------------------------------------

Hi [~bschoeni]

Sorry, I was caught up with my finals (because end of semester).

I did change the functions in `tracing.py`. I tried running the 
`cassandra-cqlsh-tests.sh` to see if nothing is broken. But, some of the tests 
timed out (both with and without the changes). How can I test my changes?

Additionally, `formatting.py` uses a function called `datetime_from_timestamp` 
from the Datastax driver 
([source|https://github.com/datastax/python-driver/blob/master/cassandra/util.py#L53]).
 It doesn't seem to be using any of the Python 2 specific datetime functions. 
Should I change this too?

Thanks!


was (Author: JIRAUSER303038):
Hi [~bschoeni]

Sorry, I was caught up with my finals (because end of semester).

I did change the functions in `tracing.py`. I tried running the 
`cassandra-cqlsh-tests.sh` to see if nothing is broken. But, some of the tests 
timed out (both with and without the changes). How can I test my changes?

Additionally, `formatting.py` uses a function called `datetime_from_timestamp` 
from the Datastax driver 
([source|https://github.com/datastax/python-driver/blob/master/cassandra/util.py#L53]).
 It doesn't seem to be using any of the Python 2 specific datetime functions. 
How should I go about changing this?

Thanks!

> Modernize CQLSH datetime conversions
> ------------------------------------
>
>                 Key: CASSANDRA-18879
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-18879
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: CQL/Interpreter
>            Reporter: Brad Schoening
>            Assignee: Arun Ganesh
>            Priority: Low
>
> Python 3.x introduced many updates to datetime conversion which allows 
> simplified conversions.
> 1. For example, tracing.py defines a function datetime_from_utc_to_local() 
> but datetime now has a native function astimezone() which will convert UTC to 
> local time.
> Review the following users of datetime which apply conversions:
>  * cqlshmain.py
>  * formatting.py 
>  * tracing.py
> Example: 
> {code:java}
> >>> a = datetime.datetime.now().astimezone(tz.tzutc())
> >>> a
> datetime.datetime(2023, 9, 25, 11, 22, 36, 251705, tzinfo=tzutc())
> >>> b = a.astimezone()
> >>> b
> datetime.datetime(2023, 9, 25, 14, 22, 36, 251705, 
> tzinfo=datetime.timezone(datetime.timedelta(seconds=10800), 'EEST')) {code}
> See [PEP 495|https://peps.python.org/pep-0495/]
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to