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

Dynamic measurement name creation #2

Open
mazamsezer opened this issue Jun 26, 2020 · 0 comments
Open

Dynamic measurement name creation #2

mazamsezer opened this issue Jun 26, 2020 · 0 comments

Comments

@mazamsezer
Copy link

Hi,

Thank you for this nice helper package.

My problem is about dynamic measurement name creation. No matter what I do, I can not make MeasurementNameComponent work. I even wrote the very same lines below, but could not make it run:

from pinform import Measurement, MeasurementNameComponent
from pinform.fields import FloatField
from pinform.tags import Tag

class OHLC(Measurement):
class Meta:
measurement_name = 'ohlc_(symbol)'

symbol = MeasurementNameComponent(name='symbol')
open = FloatField(null=False)
high = FloatField(null=False)
low = FloatField(null=False)
close = FloatField(null=False)

today_ohlc = OHLC(time_point=datetime.datetime.now(), symbol='AAPL', open=80.2, high=86.0, low=78.9, close=81.25)

Python keeps saying I provided a value for symbol, but did not inform if it is a tag or field. But I want to use it as the dynamic measurement name variable. This way I will be able to use one class for all of my readings. How can I achieve this?

Also rather than sending the field as string, integer or float I only want to send it with something like value = Field(null=True). Is this possible? If yes, how can I do it? And why did you make a differentiation on fields with different data types? If the measurement's name is different, then why didn't you use one field with "value" as tag?

Thank you,

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

1 participant