datastax / astrapy

AstraPy is a Pythonic interface for DataStax Astra DB and the Data API
https://github.com/datastax/astrapy
Apache License 2.0
21 stars 21 forks source link

[core] Love to Ops #127

Open hemidactylus opened 1 year ago

hemidactylus commented 1 year ago

The ops part of astrapy should get a systematic check: typing support is not always correct, test coverage is scarce (not an easy challenge), signature of methods should be checked.

hemidactylus commented 1 year ago

Two things come to mind:

  1. probably there's no reason why create_keyspace returns a raw httpx.Response. If so, align with the others, with custom handling since it will return 201 when successful. Much like create_database, in this case we could craft a sensible small dict to make this method uniform to the others
  2. In general, some DevOps calls return a List and others a Dict. Now everything is typed as OPS_API_RESPONSE which is union of the two, but this is not perfect. The create keyspace had to cast to dict for test to typecheck. Indeed whether dict or list is fixed for a given API call. Make the code reflect this, possibly with two _json_request and _list_request methods or something. A long, tedious work.