libraries/botbuilder-azure/botbuilder/azure/cosmosdb_storage.py
def __get_or_create_database(self, doc_client, id) -> str:
        """Return the database link.

        Check if the database exists or create the db.

        :param doc_client:
        :param id:
        :return str:
        """
        # query CosmosDB for a database with that name/id
        dbs = list(doc_client.QueryDatabases({
            "query": "SELECT * FROM r WHERE r.id=@id",
            "parameters": [
                {"name": "@id", "value": id}
            ]
        }))
        # if there are results, return the first (db names are unique)
        if len(dbs) > 0:
            return dbs[0]['id']
        else:
            # create the database if it didn't exist
            res = doc_client.CreateDatabase({'id': id})
            return res['id']
def __get_or_create_database(self, doc_client, id) -> str:
        # query CosmosDB for a database with that name/id
        dbs = list(doc_client.QueryDatabases({
            "query": "SELECT * FROM r WHERE r.id=@id",
            "parameters": [
                {"name": "@id", "value": id}
            ]
        }))
        # if there are results, return the first (db names are unique)
        if len(dbs) > 0:
            return dbs[0]['id']
        else:
            # create the database if it didn't exist
            res = doc_client.CreateDatabase({'id': id})
            return res['id']
def __get_or_create_database ( self , doc_client , id ) -> str : # query CosmosDB for a database with that name/id dbs = list ( doc_client . QueryDatabases ( { "query" : "SELECT * FROM r WHERE r.id=@id" , "parameters" : [ { "name" : "@id" , "value" : id } ] } ) ) # if there are results, return the first (db names are unique) if len ( dbs ) > 0 : return dbs [ 0 ] [ 'id' ] else : # create the database if it didn't exist res = doc_client . CreateDatabase ( { 'id' : id } ) return res [ 'id' ]
Return the database link.

        Check if the database exists or create the db.

        :param doc_client:
        :param id:
        :return str:
Return the database link .