File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -170,6 +170,27 @@ ttable = weather.timetable('Europe/Paris');
170
170
171
171
Notice that the ` time() ` and ` timetable() ` methods take an optional timezone argument.
172
172
173
+ Other commands
174
+ --------------
175
+
176
+ Use ` runCommand(command, requiresPost) ` for executing commands not provided in the library:
177
+
178
+ ``` matlab
179
+ % Show series and tag keys in a database
180
+ influxdb.runCommand('SHOW SERIES ON "example" FROM "weather"');
181
+ influxdb.runCommand('SHOW TAG KEYS ON "example" FROM "weather"');
182
+
183
+ % Create and drop a database
184
+ influxdb.runCommand('CREATE DATABASE "example"', true);
185
+ influxdb.runCommand('DROP DATABASE "example"', true);
186
+
187
+ % Create a retention policy that keeps data for one day
188
+ influxdb.runCommand('CREATE RETENTION POLICY "one_day" ON "example" DURATION 1d REPLICATION 1', true);
189
+ influxdb.runCommand('SHOW RETENTION POLICIES ON "example"', false);
190
+ ```
191
+
192
+ See the [ InfluxDB documentation] [ influxdb-docs ] for more schema exploration and management commands.
193
+
173
194
174
195
Contributing
175
196
------------
Original file line number Diff line number Diff line change 106
106
function builder = writer(obj )
107
107
builder = WriteBuilder().influxdb(obj );
108
108
end
109
+
110
+ % Execute other queries or commands
111
+ function response = runCommand(obj , command , requiresPost )
112
+ url = [obj .Url ' /query' ];
113
+ opts = weboptions(' Username' , obj .User , ' Password' , obj .Password );
114
+ if nargin > 2 && requiresPost
115
+ opts.Timeout = obj .WriteTimeout ;
116
+ response = webwrite(url , ' q' , command , opts );
117
+ else
118
+ opts.Timeout = obj .ReadTimeout ;
119
+ response = webread(url , ' q' , command , opts );
120
+ end
121
+ end
109
122
end
110
123
111
124
end
You can’t perform that action at this time.
0 commit comments