influxdb-java
influxdb-java copied to clipboard
Why are the helper functions getting deprecated?
Helpers like 'describeDatabases', 'databaseExists', 'createDatabase' etc are really .. helpful. I completely understand that all these functions are available through the more generic 'query' function but it seems really unnecessary to force users to use 'query' and then wrangle the results ourselves manually.
Surely most of the reason for a native client is to wrap low level api in helper functions to reduce user friction in the integration of influx into their solutions?
I'd be curious to know what the reason is behind this decision? Is there a discussion forum somewhere?
@alprestedge we don't have a forum but I left https://github.com/influxdata/influxdb-java/issues/399 open for a while waiting for feedback and I had none. Well, this does not mean that my changes cannot be reverted. :)
Those methods were deprecated because we want to:
- avoid issues like https://github.com/influxdata/influxdb-java/issues/398 and the nightmare that is to maintain a library that must be backward compatible with these helper methods (should we guess the version? if so, how would you do it in a performant way? If not, should we let the user configure the client with the version?);
- keep the API "simple". My point here is: all deprecated methods can be done with a few lines of code, mapping the result to a POJO.
I agree with you we should make the developer life easier. Can you help us improving this feature? IMO the maintainers will be quite happy to review your PR later.
By the way, the readme uses these deprecated functions, which is confusing for new developers.
So people are just going to copy these snippets into their code and maintain them themselves? Instead of putting them in a library like.. dedicated to that?
I also just stumbled over the deprecations and noticed two things :
- The
query
function takes aQuery
object which itself takes a database name. This name is not necessarily known, e.g. if I want to check whether the database exists or if I want to create it in the first place. - The
query
function returns a rather complicatedQueryResult
and---at least for me---it is for example not intuitive how to get the names of databases from thisQueryResult
.
Seems to be fine for me to drop the createDatabase() method but... how can I create a new one without it ? I can use Query method and pass "create database xyz" to it but what should I specify in the database field ? is it safe or does it work when it's empty ?
Query query = new Query("CREATE DATABASE xyz", ""); // safe to specify "" as dbname ? will work ?
db.query(query);
By the way, the readme uses these deprecated functions, which is confusing for new developers.
This. Update the readme.