Query generation issue with Graphene and SQLAlchemy
- Dominant language
- Python
- Stars
- 1.7k
- Forks
- 545
- PR merge metrics
- No merged PRs in 30d
Description
I'm attempting to build a GraphQL API with Hive as part of the backend. Following the documentation I created the following schema:
`class Manufacturer(SQLAlchemyObjectType):
class Meta:
model = ManufacturerModel
interfaces = (relay.Node,)
class Query(ObjectType):
node = relay.Node.Field()
all_manufacturers = SQLAlchemyConnectionField(Manufacturer.connection)`
Which leverages the following SQLAlchemy model:
`class Manufacturer(Base):
__tablename__ = 'manufacturer_hub'
manufacturer_hub_pk = Column(String, primary_key=True)
manufacturer_name = Column(String)`
I'm able to connect to the Hive cluster and a query attempts to run, but it fails due to the sort that is provided:
`SELECT
manufacturer_hub.manufacturer_hub_pk AS manufacturer_hub_manufacturer_hub_pk, manufacturer_hub.manufacturer_name AS manufacturer_hub_manufacturer_name
FROM manufacturer_hub
ORDER BY manufacturer_hub.manufacturer_hub_pk ASC`
If aliases are being provided for columns, Hive is expecting them to be used in the ORDER BY. Running the following corrected query in Hive works:
`SELECT
manufacturer_hub.manufacturer_hub_pk AS manufacturer_hub_manufacturer_hub_pk, manufacturer_hub.manufacturer_name AS manufacturer_hub_manufacturer_name
FROM manufacturer_hub
ORDER BY manufacturer_hub_manufacturer_hub_pk ASC`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.