Any idea how to resolve this error?
Code:
@strawberry.type
class Employees:
employee_id: Optional[float]
first_name: Optional[str]
last_name: Optional[str]
email: Optional[str]
def __init__(
self,
employee_id : Optional[float] = None,
first_name : Optional[str] = None,
last_name : Optional[str] = None,
email : Optional[str] = None,
) :
self.employee_id = employee_id
self.salary = salary
self.first_name = first_name
self.last_name = last_name
self.email = email
@strawberry.input
class EmployeesInput:
employee_id: Optional[float] = None
first_name: Optional[StringFilterInput] = None
last_name: Optional[StringFilterInput] = None
email: Optional[StringFilterInput] = None
@strawberry.input
class EmployeesFilterInput:
employee: Optional[EmployeesInput] = None
AND: Optional["EmployeesFilterInput"] = None
OR: Optional["EmployeesFilterInput"] = None
NOT: Optional["EmployeesFilterInput"] = None
async def get_Employees(root, info: Info, where: Optional[EmployeesFilterInput] = None) -> List[Employees]:
selected_fields = get_selected_fields(info)
predicate = get_predicate(info)
service = info.context['dremio_service']
result = await service.query(f"{selected_fields} FROM Employees.Employees {predicate}")
if isinstance(result, pd.DataFrame):
employee_records = result.to_dict(orient='records')
return [Employees(**record) for record in employee_records] # type: ignore
else:
return result.to_json()
@strawberry.type
class EmployeesQuery:
employees: List[Employees] = strawberry.field(resolver=get_Employees)
Error:
Expression of type "StrawberryField" cannot be assigned to declared type "List[Employees]"
"StrawberryField" is incompatible with "List[Employees]"Pylance
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too