question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to query backups with filter and startTime

See original GitHub issue
  • Package Name: azure-mgmt-recoveryservicesbackup
  • Package Version: 0.6.0
  • Operating System: Darwin 19.5.0 Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2/RELEASE_X86_64 x86_64
  • Python Version: Python 3.6.10

Describe the bug I am unable to query the recoveryservicesbackup api using the python sdk for date ranges on startTime.

To Reproduce Steps to reproduce the behavior: 1.

>>> iaasvm_odata_filter = "startTime eq '2020-08-1400:32:38'"
>>> backups = conn.azure_sdk_client.backup_jobs.list('auto-infrastructure-as-code-backup-vault', 'auto_infrastructure_as_code', filter=iaasvm_odata_filter)
>>> for backup in backups:
...     str(backup.properties.start_time)
...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/philipkrauss/miniconda3/envs/dev_azure24/lib/python3.6/site-packages/msrest/paging.py", line 143, in __next__
    self.advance_page()
  File "/Users/philipkrauss/miniconda3/envs/dev_azure24/lib/python3.6/site-packages/msrest/paging.py", line 129, in advance_page
    self._response = self._get_next(self.next_link)
  File "/Users/philipkrauss/miniconda3/envs/dev_azure24/lib/python3.6/site-packages/azure/mgmt/recoveryservicesbackup/operations/_backup_jobs_operations.py", line 110, in internal_paging
    raise exp
msrestazure.azure_exceptions.CloudError: Azure Error: BMSUserErrorGetJobsInvalidInput
Message: The inputs specified for Get jobs API are incorrect. Please check your inputs and try again.
Make sure your filter parameters are following these guidelines - The OData filter options. status eq { InProgress , Completed , Failed , CompletedWithWarnings , Cancelled , Cancelling } and backupManagementType eq {AzureIaasVM, MAB, DPM, AzureBackupServer, AzureSql } and operation eq { ConfigureBackup , Backup , Restore , DisableBackup , DeleteBackupData } and jobId eq {guid} and startTime eq { yyyy-mm-dd hh:mm:ss PM } and endTime eq { yyyy-mm-dd hh:mm:ss PM }.

or a filter such as

>>> iaasvm_odata_filter = "startTime ge '{}T00:00:00Z'".format(datetime.datetime.now().date())
>>> backups = conn.azure_sdk_client.backup_jobs.list('auto-infrastructure-as-code-backup-vault', 'auto_infrastructure_as_code', filter=iaasvm_odata_filter)
>>> for backup in backups:
...     str(backup.properties.start_time)
...
'2020-08-14 00:32:38.202948+00:00'
'2020-08-13 00:32:42.812803+00:00'
'2020-08-12 00:32:14.893336+00:00'
'2020-08-11 00:32:31.104376+00:00'
'2020-08-10 14:28:14.387283+00:00'
'2020-08-10 14:24:14.013058+00:00'

Expected behavior

using a filter like:

iaasvm_odata_filter = "startTime ge '{}T00:00:00Z'".format(datetime.datetime.now().date())

should return nothing, as i have no backups today yet.

Screenshots na

Additional context I will be honest this could be me not hitting the mark on whats expected, however following the exceptions, suggestion

startTime eq { yyyy-mm-dd hh:mm:ss PM }

>>> iaasvm_odata_filter = "startTime ge '2020-08-14 16:37:05 PM'"
>>> backups = conn.azure_sdk_client.backup_jobs.list('auto-infrastructure-as-code-backup-vault', 'auto_infrastructure_as_code', filter=iaasvm_odata_filter)
>>> for backup in backups:
...     str(backup.properties.start_time)
...
'2020-08-14 00:32:38.202948+00:00'
'2020-08-13 00:32:42.812803+00:00'
'2020-08-12 00:32:14.893336+00:00'
'2020-08-11 00:32:31.104376+00:00'
'2020-08-10 14:28:14.387283+00:00'
'2020-08-10 14:24:14.013058+00:00'

still no luck.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
msftbot[bot]commented, Aug 14, 2020

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @pvrk.

0reactions
pkrauss3commented, Sep 2, 2020

Yes this can be closed as working as intended.

On Wed, Sep 2, 2020, 1:24 AM Kartik P V R notifications@github.com wrote:

@DataDecay https://github.com/DataDecay : A gentle reminder. Were you able to test? Can I close this issue?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Azure/azure-sdk-for-python/issues/13123#issuecomment-685307009, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOG2UEZ4DSRAKFAZ2OWPJTDSDXJHLANCNFSM4P727NGQ .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Query your backups using Azure Resource Graph (ARG)
Learn more about querying information on backup for your Azure resources using Azure Resource Group (ARG).
Read more >
Query that displays backup information (successful and failed ...
backupset table but I want to know if there is a query that displays failed backups for a database. My query below displays...
Read more >
How to fetch Backup Duration Trend via Job Summary/shortcut
Open ssms and pass the credentials · expand 'databases' → find “CommServ” database → right click and select “new query” · New tab...
Read more >
NetWorker 9.1 REST API : Is there a way to filter (by date ... - Dell
I would like to be able to "filter by date", i.e. only get the backup since last time I made the call.
Read more >
Cove: Error "There is no data available for the backup ... - N-able
In Backup Manager, select the Preferences tab. · Select Backup Filters on the left side. · Check filters to see if all data...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found