Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write Error when initializing auto-properties #586

Open
cklenk opened this issue Oct 9, 2023 · 2 comments
Open

Write Error when initializing auto-properties #586

cklenk opened this issue Oct 9, 2023 · 2 comments

Comments

@cklenk
Copy link

cklenk commented Oct 9, 2023

Steps to reproduce:

  1. Set up measurement table with auto props with inline default values
  2. Write query by POCO
  3. Error

Expected behavior:
Able to write to measurement

Actual behavior:
Got error says unable to determine measurement. Does it have a InfluxDB.Client.Core.Measurement or IsMeasurement InfluxDB.Client.Core.Column attribute?

Specifications:

  • Client Version: 4.13.0
  • InfluxDB Version: 1.7
  • Platform: Linux
@bednar
Copy link
Contributor

bednar commented Oct 10, 2023

Hi @cklenk,

Thank you for using our client. Could you share some code that reproduces the exception you're encountering?

Regards

@cklenk
Copy link
Author

cklenk commented Oct 10, 2023

Hi @cklenk,

Thank you for using our client. Could you share some code that reproduces the exception you're encountering?

Regards

Yes, sure thing! Here is some code snippet. I think it should give you the gist of the problem. If I remove the default vars on the AlgoData class, the write works fine. Otherwise, I get that error. It's not a big deal, I have a method that will init the vars for me, but I do like to do it in 1 line on the class if possible.

[Measurement("AlgoTable")]
class AlgoData
{
[Column("DeviceId", IsTag = true)] public string DeviceId { get; set; }
[Column("input")] public double InputTemp { get; set; }
[Column("output")] public double OutputTemp { get; set; }
[Column("peakValue")] public int PeakValue { get; set; } = 0;
[Column("runningState")] public int RunningState { get; set; } = 2;
[Column("signal")] public int Signal { get; set; } = 0;
[Column(IsTimestamp = true)] public DateTime TimeStamp { get; set; }
}
async void InsertAlgoData(List algoResults)
{
using (InfluxDBClient client = GetClient(100))
{
try
{
// Write the measurement to database
await client.GetWriteApiAsync().WriteMeasurementsAsync(algoResults, WritePrecision.Ns);
}
catch (Exception ex)
{
Exceptions.LogException(ex);
}
}
}
InfluxDBClient GetClient(double timespanSeconds = 10)
{
var options = new InfluxDBClientOptions(url: "localhost")
{
Timeout = TimeSpan.FromSeconds(timespanSeconds),
LogLevel = LogLevel.Basic,
Org = "123",
Bucket = "XX"
};
return new InfluxDBClient(options);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants