question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Setting a schema name different than class name

See original GitHub issue

Is it possible to do something like:

class MyGraphQlSong(graphene.ObjectType):
  __name__ = 'Song'

  id = graphene.String()
  artist = graphene.String()
  album = graphene.String()

So that MyGraphQlSong is created in the schema just as Song, such as:

type Song {
  id: String
  artist: String
  album: String
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
helloqiucommented, Oct 15, 2018

According to the source: https://github.com/graphql-python/graphene/blob/master/graphene/types/base.py#L6 You can customize the type name like this:

class MyGraphQlSong(graphene.ObjectType):
  class Meta:
    name = 'Song'

@zhammer

0reactions
zhammercommented, Oct 15, 2018

thanks @helloqiu. i’m going to try this out tomorrow when i have some time.

also thanks for linking this to #823. graphene is cool but is in dire need of improved documentation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hibernate Tips: How to define schema and table names
In this week's Hibernate Tip, I show you how you can define the name of the table and database schema to which an...
Read more >
Setting schema name for DbContext - Stack Overflow
When I tried to set "HasDefaultSchema", I get this error - the model backing the '' context has changed since the database was...
Read more >
Documentation: 15: 5.9. Schemas - PostgreSQL
A PostgreSQL database cluster contains one or more named databases. Roles and a few other object types are shared across the entire cluster....
Read more >
Solved: Feature Names in SDE Geodatabase - Esri Community
According to this page* SDE is creating a schema with the name of the user. We can't have the user name as part...
Read more >
2 Java Applications on Oracle Database - filibeto.org
However, the names of Java schema objects cannot be longer than 31 characters. Therefore, if a schema object name is longer than 31...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found