简体   繁体   中英

Querying using custom key identifier(Name/ID) in firestore(datastore mode)?

I have a datastore entity like this below

     Name/ID              Parent                       Rollen             email          first_name      last_name
name=CidassUID  Key(Tenant, 'CidassGroupID')    ["user","admin"]    user@email.com  user first name user last name  

I would like to make a query wrt Name/ID

In GQL I am trying like this

 select * from User where Name/ID='CidassUID'

and in python like this..

    query = client.query(kind='User')
    query.add_filter('Name/ID', '=', 'name=CidassUID')
    return list(query.fetch())

Can somebody help how can I get the result via Name/ID?

Thanks a lot

so thats how i solve it in GQL..

select * from User where __key__= Key(Tenant, 'CidassGroupID', User, 'CidassUID')

and for python..

query_key=client.key('Tenant', 'CidassGroupID','User', 'CidassUID')
query.key_filter(query_key,'=')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM