Question about querying a single resource with flask sqlalchemy example.
See original GitHub issueI have followed the example at http://docs.graphene-python.org/projects/sqlalchemy/en/latest/tutorial/#testing-our-graphql-schema and have a question.
I can issue the following query to list all employees and their departments.
{
allEmployees {
edges {
node {
name
department {
name
}
}
}
}
}
I would like to be able to query a single employee name and their department name by employee id. I can query using the Node interface, but that doesn’t allow me to access Employee name field. Am I supposed to “cast” this to the specific Employee type to do that? What I would like is something like:
{
employee(id: "someid") {
name
department {
name
}
}
Is this reasonable or am I “doing it wrong”? What is best practice for accessing a single employee using the Relay connections/nodes/edges paradigm?
Many thanks in advance!
Issue Analytics
- State:
- Created 6 years ago
- Comments:7
Top Results From Across the Web
How to Use Flask-SQLAlchemy to Interact with Databases in a ...
It provides ways to interact with several database engines such as SQLite, MySQL, and PostgreSQL. It gives you access to the database's SQL ......
Read more >How to query database by id using SqlAlchemy?
Query has a get function that supports querying by the primary key of the table, which I assume that id is. For example,...
Read more >Top 31 Popular Python Flask Interview Questions With Answers
Answer: We can get the argument's value using the request object in Flask. An example is shown below. from flask import Flask from...
Read more >Python REST APIs With Flask, Connexion, and SQLAlchemy
Note: If you haven't worked through part one of this tutorial series, then make sure to download the source code by clicking the...
Read more >Object Relational Tutorial (1.x API)
The SQLAlchemy Object Relational Mapper presents a method of associating user-defined Python classes with database tables, and instances of those classes ( ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thanks for the pointers @navinesh. This worked great:
You could do something like this.