-
Notifications
You must be signed in to change notification settings - Fork 12
Code Snippets
Roy Nieterau edited this page Jul 26, 2019
·
12 revisions
The avalon database uses MongoDB. In Avalon's python api it exposes a thin wrapper around pymongo
through avalon.io
. Here are some example code snippets of how you could interact with the database.
Pymongo supports searching by regex and even allows to send a re.compile
returned object as the value for a query directly.
import avalon.io as io
import re
# Compile a regex pattern
pattern = re.compile("character_.*")
# Search in avalon database by pattern
for asset in io.find({"name": pattern, "type": "asset"}):
print(asset)