В моем Azure Cosmos существует база данных, коллекция.Проблема в том, что я застрял в том, как выводить данные запроса на выборку из Azure.Мне показываются ошибки 'TypeError:' QueryIterable 'объект не подписан на python'
Как вывести мой код из моего скрипта?
import pydocumentdb
import pydocumentdb.document_client as document_client
# Initialize the Python DocumentDB client
client = document_client.DocumentClient('https://domain.documents.azure.com:443/', {'masterKey': 'xxxxxxxxx'})
db_id = 'ppDB'
db_query = "select * from c where c.id = '{0}'".format(db_id)
db = list(client.QueryDatabases(db_query))[0]
db_link = db['_self']
coll_id = 'ppCollection'
coll_query = "select * from c where c.id = '{0}'".format(coll_id)
coll = list(client.QueryCollections(db_link, coll_query))
if coll:
coll = coll[0]
else:
raise ValueError("Collection not found in database.")
coll_link = coll['_self']
c_id = '121ad45f-a278-3218-d2ba-63aaccd1fbab'
# Query them in SQL
query = "SELECT * from c where c.id ".format(c_id)
options = {}
options['enableCrossPartitionQuery'] = True
options['maxItemCount'] = 2
res =client.QueryDocuments(coll_link, query, options)
print(res)