@@ -27,7 +27,7 @@ user = await User.get(uid)
2727
2828# query
2929users = await User.find(constraints = [
30- constraint(" status" , ConstraintTypes .EQUALS , " active" )
30+ constraint(" status" , ConstraintType .EQUALS , " active" )
3131])
3232
3333# update
@@ -43,7 +43,7 @@ if await User.exists(uid):
4343
4444# count
4545active_count = await User.count(constraints = [
46- constraint(" status" , ConstraintTypes .EQUALS , " active" )
46+ constraint(" status" , ConstraintType .EQUALS , " active" )
4747])
4848```
4949
@@ -178,11 +178,11 @@ user = await User.create(name="Ada Lovelace", email="ada@example.com")
178178user = await User.get(" 1234567890x1234567890" )
179179
180180# query with constraints
181- from bubble_data_api_client import constraint, ConstraintTypes
181+ from bubble_data_api_client import constraint, ConstraintType
182182
183183active_users = await User.find(constraints = [
184- constraint(" status" , ConstraintTypes .EQUALS , " active" ),
185- constraint(" age" , ConstraintTypes .GREATER_THAN , 18 ),
184+ constraint(" status" , ConstraintType .EQUALS , " active" ),
185+ constraint(" age" , ConstraintType .GREATER_THAN , 18 ),
186186])
187187
188188# update
@@ -235,14 +235,14 @@ user, created = await User.create_or_update(
235235Build type-safe queries using Bubble's constraint system:
236236
237237``` python
238- from bubble_data_api_client import constraint, ConstraintTypes
238+ from bubble_data_api_client import constraint, ConstraintType
239239
240240constraints = [
241- constraint(" status" , ConstraintTypes .EQUALS , " active" ),
242- constraint(" age" , ConstraintTypes .GREATER_THAN , 21 ),
243- constraint(" tags" , ConstraintTypes .CONTAINS , " premium" ),
244- constraint(" email" , ConstraintTypes .IS_NOT_EMPTY ),
245- constraint(" category" , ConstraintTypes .IN , [" A" , " B" , " C" ]),
241+ constraint(" status" , ConstraintType .EQUALS , " active" ),
242+ constraint(" age" , ConstraintType .GREATER_THAN , 21 ),
243+ constraint(" tags" , ConstraintType .CONTAINS , " premium" ),
244+ constraint(" email" , ConstraintType .IS_NOT_EMPTY ),
245+ constraint(" category" , ConstraintType .IN , [" A" , " B" , " C" ]),
246246]
247247
248248results = await User.find(constraints = constraints)
@@ -314,7 +314,7 @@ This library is async-only, but you can use it in sync code:
314314
315315``` python
316316import asyncio
317- from bubble_data_api_client import BubbleBaseModel, constraint, ConstraintTypes
317+ from bubble_data_api_client import BubbleBaseModel, constraint, ConstraintType
318318
319319class User (BubbleBaseModel , typename = " user" ):
320320 name: str
@@ -327,8 +327,8 @@ user = asyncio.run(User.get("1234567890x1234567890"))
327327# or wrap multiple operations
328328async def main ():
329329 constraints = [
330- constraint(" is_verified" , ConstraintTypes .EQUALS , True ),
331- constraint(" account_type" , ConstraintTypes .EQUALS , " premium" ),
330+ constraint(" is_verified" , ConstraintType .EQUALS , True ),
331+ constraint(" account_type" , ConstraintType .EQUALS , " premium" ),
332332 ]
333333 users = await User.find(constraints = constraints)
334334 for user in users:
0 commit comments