InfluxData.Net icon indicating copy to clipboard operation
InfluxData.Net copied to clipboard

Continuous Query Double Quote Disallows Use of Regex

Open sbhenderson opened this issue 8 years ago • 2 comments

I am finding that this code public const string CreateContinuousQuerySubQuery = "SELECT {0} INTO \"{1}\" FROM {2} GROUP BY time({3}) {4} {5}"; in https://github.com/pootzko/InfluxData.Net/blob/master/InfluxData.Net.InfluxDb/Constants/QueryStatements.cs is basically preventing the use of a regex replacement in the creation of a continuous query by forcing the INTO measurement to have double quotes.

An example query pulled from https://www.influxdata.com/continuous-queries-in-influxdb-part-i/: CREATE CONTINUOUS QUERY myquery ON testdb BEGIN SELECT mean(value) INTO "policy1".:MEASUREMENT FROM /.*/ GROUP BY time(1h) END

I think the solution would be to stop the double quoting within the const string, but obviously, that has implications for those who already use this.

sbhenderson avatar Apr 04 '17 23:04 sbhenderson

Some of the Influx syntax templates need to be updated because they're obsolete and newer versions of Influx return warnings for some queries. So not to create any breaking changes, what you're asking for will come with official 1.2 support I think.

tihomir-kit avatar Apr 05 '17 13:04 tihomir-kit

Sorry for the delay.. I didn't have enough free time to work on the lib these last few months.

I think if I updated the const string to something like:

public const string CreateContinuousQuerySubQuery = "SELECT {0} INTO \"{1}\"{2} FROM {3} GROUP BY time({4}) {5} {6}";

would probably help together with an additional CqParams param which would be appended after the double-quoted part (if that new CqParams param is not null or empty). What do you think?

tihomir-kit avatar Jul 03 '17 21:07 tihomir-kit