Package: influxable
InfluxableA lightweight python ORM / ODM / Client for InfluxDBTable of ContentsNoteGenesisChangelogFeaturesDependenciesInstallationGetting startedConnectionMeasurementSimple MeasurementInstanciationQuerySaving DataAuto Generation of MeasurementsInfluxable commandsInfluxable APIInfluxable ClassInfluxDBApi ClassConnection ClassMeasurement ClassAttributesInfluxDBResponseSerializersRaw QueryQuery ClassQuery aggregations functionQuery selectors functionQuery transformations functionInfluxDBAdminExceptionsTestingSupportingVersioningContributorsCreditsReferencesLicenseNoteThis project is currently in development.A better documentation and testing scripts will be added in the next release.GenesisI worked on a project with InfluxDB. I needed to build an API for InfluxDB and to plug with Python libraries (scipy, pandas, etc …).That’s why I decided to create this repository in order to deal with InfluxDB in a smooth way and to manipulate Python object.Changelog1.4.1Fix Setup IssueMerge PR Bump Security Issues1.4.0Add integration with Influxdb OSS 2.0 Authentication (Experimental)1.3.0Addgroup_by()method forGROUP BY tagsinstructionsAddrange()method forGROUP BY time()instructionsAddinto()method forINTOinstructionsAddtz()method1.2.1Handle chinese characters.FeaturesAdd automation for measurement class generation (command:autogenerate)Admin commands allowing to manage the database (ex:create_user(),show_series()).Measurement class allowing to make queries in order to fetch/save points (ex:Measurement.where(),Measurement.bulk_save()).Group by commandsDifferent serializers for easy data manipulation (ex:PandasSerializer).DependenciesPython 3 (Tested with Python 3.7.3)InfluxDB (Tested with InfluxDB 1.5.4)InstallationThe package is available in pypi. You can install it via pip :pip install influxableGetting startedConnectionYou can set your environment variable for the connection of InfluxDB in order to override the default values :INFLUXDB_URL=http://localhost:8086
INFLUXDB_DATABASE_NAME=default

#Optional
INFLUXDB_USER=admin
INFLUXDB_PASSWORD=changme
INFLUXDB_PASSWORD=changme

# OSS 2.0
INFLUXDB_AUTH_TOKEN=mytokenThen you just have to import the influxable package and create an instance ofInfluxable:frominfluxableimportInfluxableclient=Influxable()You can also set connection variable inInfluxableconstructor :# Without authenticationclient=Influxable(base_url='http://localhost:8086',database_name='default',)# With authenticationclient=Influxable(base_url='http://localhost:8086',database_name='default',user='admin',password='changeme',)# With token authenticationclient=Influxable(base_url='http://localhost:8086',database_name='default',token='my_token',)Measurementfrominfluxableimportattributes,serializersfrominfluxable.measurementimportMeasurementclassTemperatureMeasurement(Measurement):parser_class=serializers.MeasurementPointSerializer# Defaultmeasurement_name='temperature'time=attributes.TimestampFieldAttribute()phase=attributes.TagFieldAttribute()value=attributes.FloatFieldAttribute()Fields :GenericFieldAttribute (IntegerFieldAttribute, FloatFieldAttribute, StringFieldAttribute, BooleanFieldAttribute)TagFieldAttributeTimestampFieldAttribute, DateTimeFieldAttributeParser Classes :MeasurementPointSerializer (default)JsonSerializerFormattedSerieSerializerFlatFormattedSerieSerializerFlatSimpleResultSerializerPandasSerializerSimple Measurementfrominfluxable.measurementimportSimpleMeasurementmy_measurement=SimpleMeasurement('temperature',['value'],['phase'])Instanciationpoint=TemperatureMeasurement(time=1568970572,phase="HOT",value=23.5,)QueryYou can query withMeasurement.get_query():frominfluxable.dbimportFieldpoints=TemperatureMeasurement\.get_query()\.select('phase','value')\.where(Field('value')>15.2,Field('value')<30.5,)\.limit(100).evaluate()You can also query withQuery:frominfluxable.dbimportQuery,Fieldpoints=Query()\.select('phase','value')\.from_measurements('temperature')\.where(Field('value')>15.2,Field('value')<30.5,)\.limit(100).execute()Saving DataYou can create data by usingMeasurement.bulk_save()points=[TemperatureMeasurement(phase="HOT",value=10,time=1463289075),TemperatureMeasurement(phase="COLD",value=10,time=1463289076),]TemperatureMeasurement.bulk_save(points)You can also create data withBulkInsertQuerystr_query='''
temperature,phase=HOT value=10 1463289075000000000
temperature,phase=COLD value=10 1463289076000000000
'''raw_query=BulkInsertQuery(str_query)res=raw_query.execute()Integration with OSS 2.0 (Experimental)# Create the userinfluxusercreate--nameadmin--passwordadmin# Create the auth (in order to retrieve the token)influxauthcreate--useradmin--operator# List yours tokensinfluxauthlist# (Optional) export the INFLUXDB_AUTH_TOKENINFLUXDB_AUTH_TOKEN=my-token# Create the configinfluxconfigcreate--config-namedefaut--host-urlhttp://localhost:8086--tokenNjIYagimNbX5MaZfisDsvuGGvtULdqIY-Wt8EP4eGk-3P9KftDtZjxXU4GocTMTfM0eglkuFJQyA9uF82ZeEoA==--orgMyOrganisation# Create the bucketinfluxbucketcreate--namedefault# List your bucketinfluxbucketlistIDNameRetentionShardgroupdurationOrganizationIDSchemaType4688727b9c388f5fdefaultinfinite168h0m0sb89cbec9670f29f8implicit# Create the dbrp (link database api v1 with bucket api v2)influxv1dbrpcreate--dbdefault--rpdefault--bucket-id4688727b9c388f5f--defaultAuto Generation of MeasurementsYou can automatically generate measurement classes file with the bash commandautogenerateinfluxableautogenerate#(default to auto_generate_measurement.py)influxableautogenerate-omeasurement.pyHere is the output generated file :# auto_generate_measurement.pyfrominfluxableimportattributesfrominfluxable.measurementimportMeasurementclassCpuMeasurement(Measurement):measurement_name='cpu'time=attributes.TimestampFieldAttribute(precision='s')value=attributes.FloatFieldAttribute()host=attributes.TagFieldAttribute()Influxable commandsautogenerate: automatic generation of measurement classesinfluxableautogenerate#(default to auto_generate_measurement.py)influxableautogenerate-omeasurement.pypopulate: create a measurement filled with a set of random datainfluxablepopulateinfluxablepopulate--min_value5--max_value35-s2011-01-01T00:00:00-id1influxablepopulate--helpInfluxable APIInfluxable ClassThe Influxable main app class is a singleton. You can access it via the methodInfluxable.get_instance()__init__():base_url : url to connect to the InfluxDB server (default = ‘http://localhost:8086’)user : authentication user name (default = ‘admin’)password : authentication user password (default = ‘changeme’)database_name : name of the database (default = ‘default’)create_connection() -> Connection:base_url : url to connect to the InfluxDB server (default = ‘http://localhost:8086’)user : authentication user name (default = ‘admin’)password : authentication user password (default = ‘changeme’)database_name : name of the database (default = ‘default’)ping() -> bool:verbose : enables verbose mode (default = True)execute_query() -> json():query: influxdb query to executemethod: http method of the request (default=’get’)chunked: if enabled, responses will be chunked by series or by every 10,000 points (default=False)epoch: specified precision of the timestamp [ns,u,µ,ms,s,m,h] (default=’ns’)pretty: if enadble, the json response is pretty-printed (default=False)write_points() -> bool:points: data to write in InfluxDB line protocol formatex: mymeas,mytag1=1 value=21 1463689680000000000precision: specified precision of the timestamp [ns,u,µ,ms,s,m,h] (default=’ns’)consistency: sets the write consistency for the point [any,one,quorum,all] (default=’all’)retention_policy_name: sets the target retention policy for the write (default=’DEFAULT’)InfluxDBApi Classget_debug_requests() -> bool:request : instance of InfluxDBRequestget_debug_vars() -> bool:request : instance of InfluxDBRequestping() -> bool:request : instance of InfluxDBRequestverbose : enables verbose mode (default = True)execute_query() -> json():request : instance of InfluxDBRequestquery: influxdb query to executemethod: http method of the request (default=’get’)chunked: if enabled, responses will be chunked by series or by every 10,000 points (default=False)epoch: specified precision of the timestamp [ns,u,µ,ms,s,m,h] (default=’ns’)pretty: if enadble, the json response is pretty-printed (default=False)write_points() -> bool:request : instance of InfluxDBRequestpoints: data to write in InfluxDB line protocol formatex: mymeas,mytag1=1 value=21 1463689680000000000precision: specified precision of the timestamp [ns,u,µ,ms,s,m,h] (default=’ns’)consistency: sets the write consistency for the point [any,one,quorum,all] (default=’all’)retention_policy_name: sets the target retention policy for the write (default=’DEFAULT’)Connection Class__init__():base_url : url to connect to the InfluxDB server (default = ‘http://localhost:8086’)user : authentication user name (default = ‘admin’)password : authentication user password (default = ‘changeme’)database_name : name of the database (default = ‘default’)create() -> Connection:base_url : url to connect to the InfluxDB server (default = ‘http://localhost:8086’)user : authentication user name (default = ‘admin’)password : authentication user password (default = ‘changeme’)database_name : name of the database (default = ‘default’)Measurement ClassfieldsMust be an instance of class located ininfluxable.attributesGenericFieldAttributeIntegerFieldAttributeFloatFieldAttributeStringFieldAttributeBooleanFieldAttributeTagFieldAttributeTimestampFieldAttributeDateTimeFieldAttributeExample :classMySensorMeasurement(Measurement):measurement_name='mysensor'time=TimestampFieldAttribute(auto_now=True,precision='s')phase=TagFieldAttribute()value=IntegerFieldAttribute()parser_classMust be a class ofinfluxable.serializers:MeasurementPointSerializer (default)JsonSerializerFormattedSerieSerializerFlatFormattedSerieSerializerFlatSimpleResultSerializerPandasSerializermeasurement_nameName of the measurement in InfluxDB__init__():Set the attribute value of a MeasurementExamplepoint=MySensorMeasurement(value=0.5,phase="MOON")get_query() -> Query:Return an instance of Query whichExamplepoints=MySensorMeasurement\.get_query()\.select()\.where()\.limit()\.evaluate()dict()Return a dict of the point valuesExamplepoint=MySensorMeasurement(value=0.5,phase="MOON")point.dict()# {'time': Decimal('1568970572'), 'phase': 'MOON', 'value': 0.5}items()Return an item list of the point valuesExamplepoint=MySensorMeasurement(value=0.5,phase="MOON")point.items()# dict_items([('time', Decimal('1568970572')), ('phase', 'MOON'), ('value', 0.5)])bulk_save()Save a list of measurement pointpoints=[MySensorMeasurement(phase="moon",value=5,time=1463489075),MySensorMeasurement(phase="moon",value=7,time=1463489076),MySensorMeasurement(phase="sun",value=8,time=1463489077),]MySensorMeasurement.bulk_save(points)AttributesGenericFieldAttributeattribute_name : real name of the measurement attribute in databasedefault : set a default value if it is not filled at the instanciationis_nullable : if False, it will raise an error if the value is null (default=True)enforce_cast : if False, it will not raise an error when the value has not the desired type without casting (default=True).classMySensorMeasurement(Measurement):measurement_name='mysensor'temperature_value=GenericFieldAttribute(attribute_name="temp_v1",default="15",is_nullable=True,enforce_cast=False,)IntegerFieldAttributemin_value : an error is raised if the value is less than the min_valuemax_value : an error is raised if the value is greater than the max_valueattribute_name : real name of the measurement attribute in databasedefault : set a default value if it is not filled at the instanciationis_nullable : if False, it will raise an error if the value is null (default=True)enforce_cast : if False, it will not raise an error when the value has not the desired type without casting (default=True).classMySensorMeasurement(Measurement):measurement_name='mysensor'temperature_value=IntegerFieldAttribute(min_value=10,max_value=30,)FloatFieldAttributemax_nb_decimals : set the maximal number of decimals to displaymin_value : an error is raised if the value is less than the min_valuemax_value : an error is raised if the value is greater than the max_valueattribute_name : real name of the measurement attribute in databasedefault : set a default value if it is not filled at the instanciationis_nullable : if False, it will raise an error if the value is null (default=True)enforce_cast : if False, it will not raise an error when the value has not the desired type without casting (default=True).classMySensorMeasurement(Measurement):measurement_name='mysensor'value=FloatFieldAttribute(max_nb_decimals=5,)StringFieldAttributechoices : an error is raised if the value is not in the list of string optionsmax_length : an error is raised if the string value length is greater than the max_lengthattribute_name : real name of the measurement attribute in databasedefault : set a default value if it is not filled at the instanciationis_nullable : if False, it will raise an error if the value is null (default=True)enforce_cast : if False, it will not raise an error when the value has not the desired type without casting (default=True).classMySensorMeasurement(Measurement):measurement_name='mysensor'position=FloatFieldAttribute(choices=['first','last'],max_length=7,)BooleanFieldAttributeattribute_name : real name of the measurement attribute in databasedefault : set a default value if it is not filled at the instanciationis_nullable : if False, it will raise an error if the value is null (default=True)enforce_cast : if False, it will not raise an error when the value has not the desired type without casting (default=True).classMySensorMeasurement(Measurement):measurement_name='mysensor'is_marked=BooleanFieldAttribute(default=False,)TagFieldAttributeattribute_name : real name of the measurement attribute in databasedefault : set a default value if it is not filled at the instanciationis_nullable : if False, it will raise an error if the value is null (default=True)enforce_cast : if False, it will not raise an error when the value has not the desired type without casting (default=True).classMySensorMeasurement(Measurement):measurement_name='mysensor'phase=TagFieldAttribute(default='MOON',)TimestampFieldAttributeauto_now : Set automatically the current date (default=False)precision : Set the timestamp precision which must be one of [ns,u,ms,s,m,h] (default= ‘ns’)attribute_name : real name of the measurement attribute in databasedefault : set a default value if it is not filled at the instanciationis_nullable : if False, it will raise an error if the value is null (default=True)enforce_cast : if False, it will not raise an error when the value has not the desired type without casting (default=True).classMySensorMeasurement(Measurement):measurement_name='mysensor'time=TimestampFieldAttribute(auto_now=True,precision='s',)DateTimeFieldAttributestr_format : Set the arrow format of the timestamp to display (default: “YYYY-MM-DD HH:mm:ss”)auto_now : Set automatically the current dateprecision : Set the timestamp precision which must be one of [ns,u,ms,s,m,h]attribute_name : real name of the measurement attribute in databasedefault : set a default value if it is not filled at the instanciationis_nullable : if False, it will raise an error if the value is null (default=True)enforce_cast : if False, it will not raise an error when the value has not the desired type without casting (default=True).classMySensorMeasurement(Measurement):measurement_name='mysensor'date=DateTimeFieldAttribute(attribute_name='time',auto_now=True,str_format='YYYY-MM-DD',)InfluxDBResponse__init__():raw_json : the raw json response objectrawReturn the raw_json valuemain_serieReturn the first serie from theseriesfield in the raw_json valueseriesReturn theseriesfield in the raw_json valueerrorReturn theerrorfield in the raw_json valueExample of json raw response :{"results":[{"statement_id":0,"series":[{"name":"mymeas","columns":["time","myfield","mytag1","mytag2"],"values":[["2017-03-01T00:16:18Z",33.1,null,null],["2017-03-01T00:17:18Z",12.4,"12","14"]]}]}]}SerializersSerializers can be used inparser_classfield ofMeasurementclass.classMySensorMeasurement(Measurement):measurement_name='mysensor'parser_class=serializers.BaseSerializerIt allow to change the output response format of a influxb request# res is formatted with BaseSerializerres=MySensorMeasurement.get_query().limit(10).evaluate()BaseSerializer# res is formatted with BaseSerializerres{'results':[{'statement_id':0,'series':[{'name':'mysamplemeasurement','columns':['time','value'],'values':[[1570481055000000000,10],[1570481065000000000,20],[1570481075000000000,30]]}]}]}JsonSerializer# res is formatted with JsonSerializerres'{"results": [{"statement_id": 0, "series": [{"name": "mysamplemeasurement", "columns": ["time", "value"], "values": [[1570481055000000000, 10], [1570481065000000000, 20], [1570481075000000000, 30]]}]}]}'FormattedSerieSerializer# res is formatted with FormattedSerieSerializerres[{'mysamplemeasurement':[{'time':1570481055000000000,'value':10},{'time':1570481065000000000,'value':20},{'time':1570481075000000000,'value':30}]}]FlatFormattedSerieSerializer# res is formatted with FlatFormattedSerieSerializer[{'time':1570481055000000000,'value':10},{'time':1570481065000000000,'value':20},{'time':1570481075000000000,'value':30}]FlatSimpleResultSerializerThis serializer is used only when the result set contains only one columnres=InfluxDBAdmin.show_databases()# res is formatted with FlatSimpleResultSerializerres['_internal','example','test','telegraf','mydb',...]FlatSingleValueSerializerThis serializer is used only when the result set contains only one valueres=InfluxDBAdmin.show_measurement_cardinality()# res is formatted with FlatSingleValueSerializerres2PandasSerializer# res is formatted with PandasSerializerrestimevalue015704810550000000001011570481065000000000202157048107500000000030MeasurementPointSerializerThis is the default serializer class for Measurement[<MySensorMeasurementobjectat0x7f49a16227f0>,<MySensorMeasurementobjectat0x7f49a16228d0>,<MySensorMeasurementobjectat0x7f49a1622438>]Raw Querystr_queryExample :frominfluxable.dbimportRawQuerystr_query='SHOW DATABASES'res=RawQuery(str_query).execute()frominfluxable.dbimportRawQuerystr_query='SELECT * FROM temperature LIMIT 10'res=RawQuery(str_query).execute()Query ClassYou can generate an instance of Query via the initial Query constructor or from a measurement.Example :frominfluxable.dbimportQueryquery=Query()...query=MySensorMeasurement.get_query()...Methods :from_measurements()*measurementsExample :query=Query()\.from_measurements('measurement1','measurement2')Render :FROMmeasurement1,measurement2select()*fieldsExample :query=Query()\.select('param1','param2')\.from_measurements('measurement1')Render :SELECTvalue,phasewhere()*criteriaExample :frominfluxable.dbimportQuery,Fieldquery=Query()\.select('param1','param2')\.from_measurements('measurement1')\.where(Field('param1')>800,Field('param1')<900,)Render :WHEREparam1>800ANDparam1<900limit()valueExample :frominfluxable.dbimportQuery,Fieldquery=Query()\.select('param1','param2')\.from_measurements('measurement1')\.where(Field('param1')>800,Field('param1')<900,)\.limit(10)Render :LIMIT10slimit()valueExample :frominfluxable.dbimportQuery,Fieldquery=Query()\.select('param1','param2')\.from_measurements('measurement1')\.where(Field('param1')>800,Field('param1')<900,)\.limit(10)\.slimit(5)Render :SLIMIT5offset()valueExample :frominfluxable.dbimportQuery,Fieldquery=Query()\.select('param1','param2')\.from_measurements('measurement1')\.where(Field('param1')>800,Field('param1')<900,)\.offset(10)Render :OFFSET10soffset()valueExample :frominfluxable.dbimportQuery,Fieldquery=Query()\.select('param1','param2')\.from_measurements('measurement1')\.where(Field('param1')>800,Field('param1')<900,)\.offset(10)\.soffset(5)Render :SOFFSET5into()*measurementExample :query=Query()\.select('param1')\.from_measurements('measurement1')\.into('measurement2')Render :SELECTparam1INTOmeasurement2FROMmeasurement1asc()Example :query=Query()\.select('param1')\.from_measurements('measurement1')\.asc()Render :SELECTparam1FROMmeasurement1ORDERBYASCdesc()Example :query=Query()\.select('param1')\.from_measurements('measurement1')\.desc()Render :SELECTparam1FROMmeasurement1ORDERBYDESCtz()Example :query=Query()\.select('param1')\.from_measurements('measurement1')\.tz('Europe/Paris')Render :SELECTparam1FROMmeasurement1tz('Europe/Paris')group_by()*tagsExample :query=Query()\.select('param1')\.from_measurements('measurement1')\.group_by('tag_1')Render :SELECTparam1FROMmeasurement1GROUPBYtag_1range_by()*interval*shift*fill*tagsExample :query=Query()\.select('param1')\.from_measurements('measurement1')\.range_by('12s',shift='1d',tags=['tag1'],fill=3)Render :SELECTparam1FROMmeasurement1GROUPBYtime(12s,1d),tag1fill(3)'execute()Execute the query and return the responseExample :frominfluxable.dbimportQuery,Fieldres=Query()\.select('param1','param2')\.from_measurements('measurement1')\.where(Field('param1')>800,Field('param1')<900,)\.execute()resResult :{'results':[{'statement_id':0,'series':[{'name':'measurement1','columns':['time','value'],'values':[[1570481055000000000,10],[1570481065000000000,20],[1570481075000000000,30]]}]}]}evaluate()Execute the query and return the serialized responseparser_class (default=BaseSerializer for Query and MeasurementPointSerializer for Measurement)Example with Query :frominfluxable.dbimportQuery,Fieldres=Query()\.select('param1','param2')\.from_measurements('measurement1')\.where(Field('param1')>800,Field('param1')<900,)\.evaluate()resResult :{'results':[{'statement_id':0,'series':[{'name':'measurement1','columns':['time','value'],'values':[[1570481055000000000,10],[1570481065000000000,20],[1570481075000000000,30]]}]}]}Example with Measurement :frominfluxable.dbimportFieldpoints=MySensorMeasurement.get_query().select('param1','param2')\.from_measurements('measurement1')\.where(Field('param1')>800,Field('param1')<900,)\.evaluate()pointsResult :[<MySensorMeasurementobjectat0x7f49a16227f0>,<MySensorMeasurementobjectat0x7f49a16228d0>,<MySensorMeasurementobjectat0x7f49a1622438>]count()value (default=’*’)Example :frominfluxable.dbimportQuery,Fieldquery=Query()\.from_measurements('measurement1')\.where(Field('param1')>800,Field('param1')<900,)\.count()Render :SELECTCOUNT(*)distinct()value (default=’*’)Example :frominfluxable.dbimportQuery,Fieldquery=Query()\.from_measurements('measurement1')\.where(Field('param1')>800,Field('param1')<900,)\.distinct()Render :SELECTDISTINCT(*)integral()value (default=’*’)Example :frominfluxable.dbimportQuery,Fieldquery=Query()\.from_measurements('measurement1')\.where(Field('param1')>800,Field('param1')<900,)\.integral()Render :SELECTINTEGRAL(*)mean()value (default=’*’)Example :frominfluxable.dbimportQuery,Fieldquery=Query()\.from_measurements('measurement1')\.where(Field('param1')>800,Field('param1')<900,)\.mean()Render :SELECTMEAN(*)median()value (default=’*’)Example :frominfluxable.dbimportQuery,Fieldquery=Query()\.from_measurements('measurement1')\.where(Field('param1')>800,Field('param1')<900,)\.median()Render :SELECTMEDIAN(*)mode()value (default=’*’)Example :frominfluxable.dbimportQuery,Fieldquery=Query()\.from_measurements('measurement1')\.where(Field('param1')>800,Field('param1')<900,)\.mode()Render :SELECTMODE(*)spread()value (default=’*’)Example :frominfluxable.dbimportQuery,Fieldquery=Query()\.from_measurements('measurement1')\.where(Field('param1')>800,Field('param1')<900,)\.spread()Render :SELECTSPREAD(*)std_dev()value (default=’*’)Example :frominfluxable.dbimportQuery,Fieldquery=Query()\.from_measurements('measurement1')\.where(Field('param1')>800,Field('param1')<900,)\.std_dev()Render :SELECTSTDDEV(*)sum()value (default=’*’)Example :frominfluxable.dbimportQuery,Fieldquery=Query()\.from_measurements('measurement1')\.where(Field('param1')>800,Field('param1')<900,)\.sum()Render :SELECTSUM(*)Query aggregations functionUsage :frominfluxable.db.functionimportaggregationsres=Query()\.select(aggregations.Sum('value'))\.from_measurements('param1')\.execute()CountDistinctIntegralMeanMedianModeSpreadStdDevSumQuery selectors functionUsage :frominfluxable.db.functionimportselectorsres=Query()\.select(selectors.Min('value'),selectors.Max('value'))\.from_measurements('param1')\.execute()BottomFirstLastMaxMinPercentileSampleTopQuery transformations functionUsage :frominfluxable.db.functionimportselectors,transformationsres=Query()\.select(transformations.Abs('value'))\.from_measurements('param1')\.execute()frominfluxable.db.function.selectorsimportMin,Maxfrominfluxable.db.function.transformationsimportAbsres=Query()\.select(Abs(Min('value')),Abs(Max('value')))\.from_measurements('param1')\.execute()AbsACosASinATanATan2CeilCosCumulativeSumDerivativeDifferenceElapsedExpFloorHistogramLnLogLog2Log10MovingAverageNonNegativeDerivativeNonNegativeDifferencePowRoundSinSqrtTanInfluxDBAdminalter_retention_policy()policy_nameduration (default=None)replication (default=None)shard_duration (default=None)is_default (default=False)ALTERRETENTIONPOLICY{policy_name}ON{database_name}[DURATION{duration}REPLICATION{replication}SHARDDURATION{shard_duration}DEFAULT]create_database()new_database_nameduration (default=None)replication (default=None)shard_duration (default=None)policy_name (default=False)CREATEDATABASE{new_database_name}[WITHDURATION{duration}REPLICATION{replication}SHARDDURATION{shard_duration}NAME{policy_name}]create_retention_policy()policy_nameduration (default=None)replication (default=None)shard_duration (default=None)is_default (default=False)CREATERETENTIONPOLICY{policy_name}ON{database_name}[DURATION{duration}REPLICATION{replication}SHARDDURATION{shard_duration}DEFAULT]create_subscription()subscription_namehostsany (default=False)CREATESUBSCRIPTION{subscription_name}ON{database_name}DESTINATIONSANY/ALL{hosts}create_user()user_namepasswordwith_privileges (default=False)CREATEUSER{user_name}WITHPASSWORD{password}[WITHALLPRIVILEGES]delete()measurements (default=[])criteria (default=[])DELETEFROM{measurements}WHERE{criteria}drop_continuous_query()query_nameDROPCONTINUOUSQUERY{query_name}ON{database_name}drop_database()database_name_to_deleteDROPDATABASE{database_name_to_delete}drop_measurement()measurement_nameDROPMEASUREMENT{measurement_name}drop_retention_policy()policy_nameDROPRETENTIONPOLICY{policy_name}ON{database_name}drop_series()measurements (default=[])criteria (default=[])DROPSERIESFROM{measurements}WHERE{criteria}drop_subscription()subscription_nameDROPSUBSCRIPTION{subscription_name}ON{full_database_name}drop_user()user_nameDROPUSER{user_name}explain()queryanalyze (default=False)EXPLAIN[ANALYZE]{query}grant()privilegeuser_nameGRANT{privilege}ON{database_name}TO{user_name}kill()query_idKILLQUERY{query_id}revoke()privilegeuser_nameREVOKE{privilege}ON{database_name}FROM{user_name}show_field_key_cardinality()exact (default=False)SHOWFIELDKEY[EXACT]CARDINALITYshow_measurement_cardinality()exact (default=False)SHOWMEASUREMENT[EXACT]CARDINALITYshow_series_cardinality()exact (default=False)SHOWSERIES[EXACT]CARDINALITYshow_tag_key_cardinality()keyexact (default=False)SHOWTAGVALUES[EXACT]CARDINALITYWITHKEY={key}show_continuous_queries()SHOWCONTINUOUSQUERIESshow_diagnostics()SHOWDIAGNOSTICSshow_field_keys()measurements (default=[])SHOWFIELDKEYSFROM{measurements}show_grants()user_nameSHOWGRANTSFOR{user_name}show_databases()SHOWDATABASESshow_measurements()criteria (default=[])SHOWMEASUREMENTSWHERE{criteria}show_queries()SHOWQUERIESshow_retention_policies()SHOWRETENTIONPOLICIESshow_series()measurements (default=[])criteria (default=[])limit (default=None)offset (default=None)SHOWSERIESON{database_name}[FROM{measurements}WHERE{criteria}LIMIT{limit}OFFSET{offset}]show_stats()SHOWSTATSshow_shards()SHOWSHARDSshow_shard_groups()SHOWSHARDGROUPSshow_subscriptions()SHOWSUBSCRIPTIONSshow_tag_keys()measurements (default=[])SHOWTAGKEYS[FROM{measurements}]show_tag_values()keymeasurements (default=[])SHOWTAGVALUES[FROM{measurements}]WITHKEY={key}show_users()SHOWUSERSExceptionsInfluxDBExceptionInfluxDBErrorInfluxDBConnectionErrorInfluxDBInvalidResponseErrorInfluxDBInvalidChoiceErrorInfluxDBInvalidTypeErrorInfluxDBInvalidURLErrorInfluxDBBadRequestErrorInfluxDBBadQueryErrorInfluxDBInvalidNumberErrorInfluxDBInvalidTimestampErrorInfluxDBUnauthorizedErrorInfluxDBAttributeValueErrorTestingFirst, you need to install pytest via the filerequirements-test.txtpipinstall-rrequirements-test.txtThen, you can launch thepytestcommand.pytest-vSupportingFeel free to post issues your feedback or if you reach a problem with influxable library.If you want to contribute, please use the pull requests section.VersioningWe useSemVerfor versioning. For the versions available, see thetags on this repositoryContributorsJavid MougamadouCreditsLogo designed byMaxime BergerardReferencesInfluxdb WebsiteInfluxdb Github RepositoryInfluxdb-Python Github RepositoryLicenseMIT