import graphene


class Person(graphene.Interface):
    name = graphene.String()
    age = graphene.ID()


class Patron(Person):
    id = graphene.ID()


class Query(graphene.ObjectType):

    patron = graphene.Field(Patron)

    def resolve_patron(self, args, info):
        return Patron(id=1, name='Demo')

schema = graphene.Schema(query=Query)
query = '''
    query something{
      patron {
        id
        name
      }
}
'''
result = schema.execute(query)
# Print the result
print(result.data['patron'])

import graphene


class Patron(graphene.ObjectType):
    id = graphene.ID()
    name = graphene.String()
    age = graphene.ID()


class Query(graphene.ObjectType):

    patron = graphene.Field(Patron)

    def resolve_patron(self, args, info):
        return Patron(id=1, name='Demo')

schema = graphene.Schema(query=Query)
query = '''
    query something{
      patron {
        id
        name
      }
}
'''
result = schema.execute(query)
print(result.data['patron'])

Modify the field example to remove the use of interface
Modify the field example to remove the use of interface

  import graphene
  
  
- class Person(graphene.Interface):
+ class Patron(graphene.ObjectType):
+     id = graphene.ID()
      name = graphene.String()
      age = graphene.ID()
- 
- 
- class Patron(Person):
-     id = graphene.ID()
  
  
  class Query(graphene.ObjectType):
  
      patron = graphene.Field(Patron)
  
      def resolve_patron(self, args, info):
          return Patron(id=1, name='Demo')
  
  schema = graphene.Schema(query=Query)
  query = '''
      query something{
        patron {
          id
          name
        }
  }
  '''
  result = schema.execute(query)
- # Print the result
  print(result.data['patron'])
  
Modify the field example to remove the use of interface
## Code Before:
import graphene


class Person(graphene.Interface):
    name = graphene.String()
    age = graphene.ID()


class Patron(Person):
    id = graphene.ID()


class Query(graphene.ObjectType):

    patron = graphene.Field(Patron)

    def resolve_patron(self, args, info):
        return Patron(id=1, name='Demo')

schema = graphene.Schema(query=Query)
query = '''
    query something{
      patron {
        id
        name
      }
}
'''
result = schema.execute(query)
# Print the result
print(result.data['patron'])

## Instruction:
Modify the field example to remove the use of interface
## Code After:
import graphene


class Patron(graphene.ObjectType):
    id = graphene.ID()
    name = graphene.String()
    age = graphene.ID()


class Query(graphene.ObjectType):

    patron = graphene.Field(Patron)

    def resolve_patron(self, args, info):
        return Patron(id=1, name='Demo')

schema = graphene.Schema(query=Query)
query = '''
    query something{
      patron {
        id
        name
      }
}
'''
result = schema.execute(query)
print(result.data['patron'])
