You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add examples for BackupService and RestoreService #617
Proposal:
Add examples demonstrating how to use the BackupService and RestoreService as they are both currently undocumented.
Current behavior:
Examples are missing apart from brief comments in the source code.
Desired behavior:
It would be nice to have examples demonstrating how to use both services, possibly in the examples directory or in the README. Personally, I would like to use BackupService and RestoreService to perform migrations but am unsure how to use these services.
Alternatives considered:
Other alternatives to the BackupService and RestoreService is using the Influx CLI with Python subprocess calls, but this is less testable and not preferred.
Use case:
Performing backups or restores using the InfluxDB Python client would be much easier with documentation.
I get errors with BackupService: Platform: macOS Sonoma 14.1.1 Apple M1 Max. Python version: 3.11.6. influxdb-client-python version: 1.38.0. InfluxDB version: OSS 2.7.4. Reproducible code:
frominfluxdb_clientimportInfluxDBClientfrominfluxdb_client.serviceimportBackupService# Using the Docker container setup with scripts/influxdb-restart.sh# and imported data from the bird migration sample setclient=InfluxDBClient(url="http://localhost:8086", token="my-token",
org="my-org")
metadata=BackupService(client.api_client).get_backup_metadata_with_http_info()
Error:
Traceback (most recent call last):
File "/Users/trevor.bonas/reproduce.py", line 6, in<module>
metadata = BackupService(client.api_client).get_backup_metadata_with_http_info()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/influxdb_client/service/backup_service.py", line 182, in get_backup_metadata_with_http_info
return self.api_client.call_api(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/influxdb_client/_sync/api_client.py", line 343, in call_api
return self.__call_api(resource_path, method,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/influxdb_client/_sync/api_client.py", line 173, in __call_api
response_data = self.request(
^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/influxdb_client/_sync/api_client.py", line 365, in request
return self.rest_client.GET(url,
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/influxdb_client/_sync/rest.py", line 268, in GET
return self.request("GET", url,
^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/influxdb_client/_sync/rest.py", line 250, in request
r.data = r.data.decode('utf8')
^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xed in position 166: invalid continuation byte
When the hardcoded value in influxdb_client/_sync/rest.py is changed from utf8 to latin1 then this error occurs:
Traceback (most recent call last):
File "/Users/trevor.bonas/reproduce.py", line 6, in<module>
metadata = BackupService(client.api_client).get_backup_metadata_with_http_info()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/trevor.bonas/influxdb-client-python/influxdb_client/service/backup_service.py", line 182, in get_backup_metadata_with_http_info
return self.api_client.call_api(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/trevor.bonas/influxdb-client-python/influxdb_client/_sync/api_client.py", line 343, in call_api
return self.__call_api(resource_path, method,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/trevor.bonas/influxdb-client-python/influxdb_client/_sync/api_client.py", line 185, in __call_api
return_data = self.deserialize(response_data, response_type)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/trevor.bonas/influxdb-client-python/influxdb_client/_sync/api_client.py", line 257, in deserialize
return self.__deserialize(data, response_type)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/trevor.bonas/influxdb-client-python/influxdb_client/_sync/api_client.py", line 296, in __deserialize
return self.__deserialize_model(data, klass)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/trevor.bonas/influxdb-client-python/influxdb_client/_sync/api_client.py", line 647, in __deserialize_model
instance = klass(**kwargs)
^^^^^^^^^^^^^^^
File "/Users/trevor.bonas/influxdb-client-python/influxdb_client/domain/metadata_backup.py", line 51, in __init__
self.kv = kv
^^^^^^^
File "/Users/trevor.bonas/influxdb-client-python/influxdb_client/domain/metadata_backup.py", line 72, in kv
raise ValueError("Invalid value for `kv`, must not be `None`") # noqa: E501
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: Invalid value for`kv`, must not be `None`
Argument values for get_backup_metadata_with_http_info have no effect re: the errors.
Let me know whether my usage is correct, whether you have any tips for getting BackupService working, or whether I should make a separate issue for these errors.
I get errors with BackupService: Platform: macOS Sonoma 14.1.1 Apple M1 Max. Python version: 3.11.6. influxdb-client-python version: 1.38.0. InfluxDB version: OSS 2.7.4. Reproducible code:
frominfluxdb_clientimportInfluxDBClientfrominfluxdb_client.serviceimportBackupService# Using the Docker container setup with scripts/influxdb-restart.sh# and imported data from the bird migration sample setclient=InfluxDBClient(url="http://localhost:8086", token="my-token",
org="my-org")
metadata=BackupService(client.api_client).get_backup_metadata_with_http_info()
Error:
Traceback (most recent call last):
File "/Users/trevor.bonas/reproduce.py", line 6, in<module>
metadata = BackupService(client.api_client).get_backup_metadata_with_http_info()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/influxdb_client/service/backup_service.py", line 182, in get_backup_metadata_with_http_info
return self.api_client.call_api(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/influxdb_client/_sync/api_client.py", line 343, in call_api
return self.__call_api(resource_path, method,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/influxdb_client/_sync/api_client.py", line 173, in __call_api
response_data = self.request(
^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/influxdb_client/_sync/api_client.py", line 365, in request
return self.rest_client.GET(url,
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/influxdb_client/_sync/rest.py", line 268, in GET
return self.request("GET", url,
^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/influxdb_client/_sync/rest.py", line 250, in request
r.data = r.data.decode('utf8')
^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xed in position 166: invalid continuation byte
When the hardcoded value in influxdb_client/_sync/rest.py is changed from utf8 to latin1 then this error occurs:
Traceback (most recent call last):
File "/Users/trevor.bonas/reproduce.py", line 6, in<module>
metadata = BackupService(client.api_client).get_backup_metadata_with_http_info()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/trevor.bonas/influxdb-client-python/influxdb_client/service/backup_service.py", line 182, in get_backup_metadata_with_http_info
return self.api_client.call_api(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/trevor.bonas/influxdb-client-python/influxdb_client/_sync/api_client.py", line 343, in call_api
return self.__call_api(resource_path, method,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/trevor.bonas/influxdb-client-python/influxdb_client/_sync/api_client.py", line 185, in __call_api
return_data = self.deserialize(response_data, response_type)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/trevor.bonas/influxdb-client-python/influxdb_client/_sync/api_client.py", line 257, in deserialize
return self.__deserialize(data, response_type)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/trevor.bonas/influxdb-client-python/influxdb_client/_sync/api_client.py", line 296, in __deserialize
return self.__deserialize_model(data, klass)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/trevor.bonas/influxdb-client-python/influxdb_client/_sync/api_client.py", line 647, in __deserialize_model
instance = klass(**kwargs)
^^^^^^^^^^^^^^^
File "/Users/trevor.bonas/influxdb-client-python/influxdb_client/domain/metadata_backup.py", line 51, in __init__
self.kv = kv
^^^^^^^
File "/Users/trevor.bonas/influxdb-client-python/influxdb_client/domain/metadata_backup.py", line 72, in kv
raise ValueError("Invalid value for `kv`, must not be `None`") # noqa: E501
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: Invalid value for`kv`, must not be `None`
Argument values for get_backup_metadata_with_http_info have no effect re: the errors.
Let me know whether my usage is correct, whether you have any tips for getting BackupService working, or whether I should make a separate issue for these errors.
The library is badly outdated it seems, I am trying to restore a bucket and using RestoreService.post_restore_bucket_id returns the following error, and then further checking on my server, the endpoint that is pointing to this method, doesn't exists. The other methods for restoring or taking backups also don't work, I switched to the golang version and it looks that one is up to date.
Activity
bednar commentedon Nov 28, 2023
Hi @trevorbonas,
Thanks for using our client.
Is this something you would be willing to help with? All PR is welcome and we will be happy to review your submission.
Regards
trevorbonas commentedon Nov 28, 2023
@bednar I would love to but:
I don't know how to use these services correctly.
I get errors with
BackupService:Platform: macOS Sonoma 14.1.1 Apple M1 Max.
Python version: 3.11.6.
influxdb-client-python version: 1.38.0.
InfluxDB version: OSS 2.7.4.
Reproducible code:
Error:
When the hardcoded value in
influxdb_client/_sync/rest.pyis changed fromutf8tolatin1then this error occurs:Argument values for
get_backup_metadata_with_http_infohave no effect re: the errors.Let me know whether my usage is correct, whether you have any tips for getting
BackupServiceworking, or whether I should make a separate issue for these errors.lenoqt commentedon Mar 13, 2024
The library is badly outdated it seems, I am trying to restore a bucket and using
RestoreService.post_restore_bucket_idreturns the following error, and then further checking on my server, the endpoint that is pointing to this method, doesn't exists. The other methods for restoring or taking backups also don't work, I switched to the golang version and it looks that one is up to date.