I'd like to be able to change the name of the class as it's represented in the query.
Example:
class HeroAndDroid(NamedTuple):
hero: Hero
droid: Droid
and instead of
print(GQL(QUERY | HeroAndDroid).query)
# 'query HeroAndDroid{hero{name}droid{name}}'
I'd like to do something like
print(GQL(QUERY | HeroAndDroid * AS * 'asdf').query)
# 'query asdf{hero{name}droid{name}}'
or
print(GQL(QUERY | HeroAndDroid * AS * ANONYMOUS).query)
# 'query {hero{name}droid{name}}'
Of course I can do it like this
#RENAME = lambda cls, name: type(name, (cls,), {})
RENAME = lambda cls, name: (setattr(cls, '__name__', name), cls)[-1]
print(GQL(QUERY | RENAME(HeroAndDroid, 'I_Prefer_This_Name')).query)
# 'query I_Prefer_This_Name{hero{name}droid{name}}'
but I think using the AS function for this is much more suitable.
I'd like to be able to change the name of the class as it's represented in the query.
Example:
and instead of
I'd like to do something like
or
Of course I can do it like this
but I think using the
ASfunction for this is much more suitable.