influxdb-java icon indicating copy to clipboard operation
influxdb-java copied to clipboard

Why are the helper functions getting deprecated?

Open alprestedge opened this issue 6 years ago • 6 comments

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 avatar May 20 '18 06:05 alprestedge

@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:

  1. 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?);
  2. 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.

fmachado avatar May 23 '18 18:05 fmachado

By the way, the readme uses these deprecated functions, which is confusing for new developers.

KeatsPeeks avatar Jun 20 '18 23:06 KeatsPeeks

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?

AlexandreRio avatar Sep 06 '18 12:09 AlexandreRio

I also just stumbled over the deprecations and noticed two things :

  1. The query function takes a Query 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.
  2. The query function returns a rather complicated QueryResult and---at least for me---it is for example not intuitive how to get the names of databases from this QueryResult.

contradictioned avatar Sep 21 '18 11:09 contradictioned

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);

andreabenini avatar Oct 04 '18 15:10 andreabenini

By the way, the readme uses these deprecated functions, which is confusing for new developers.

This. Update the readme.

pconroy328 avatar Jan 23 '19 22:01 pconroy328