profusion / sgqlc

Simple GraphQL Client
https://sgqlc.readthedocs.io/
ISC License
513 stars 85 forks source link

Is there a way to override the camel casing conversion? #137

Closed rohansharmaa closed 3 years ago

rohansharmaa commented 3 years ago

I have a table column that is named in the format COLUMN_NAME, but on creating an operation it gets converted to COLUMNName.

class Query(Type):
    COLUMN_NAME = Field(COLUMN_NAME)

op = Operation(Query)
print(op)

The above code prints - query { COLUMNName }

Is there a way to override this behavior? I want to keep using snake_case as I have a collection of tables that are all named in that format.

barbieri commented 3 years ago

Not in the code generator, but if you write it manually you can always specify the graphql_name, see https://sgqlc.readthedocs.io/en/latest/sgqlc.types.html#using-field-instances