Skip to content

Should metadata queries and mutations use the naming convention? #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jorgebay opened this issue Apr 1, 2020 · 5 comments
Closed

Comments

@jorgebay
Copy link
Contributor

jorgebay commented Apr 1, 2020

Should metadata queries and mutations use the naming convention or should the names used be a reflection of the db schema?

For example, given this metadata query:

 { tables { name }}

and tables books_by_author and books_by_title in the db.

A) Then the result should be:

{
  "data": {
    "tables": [
      {
        "name": "books_by_author"
      },
      {
        "name": "books_by_title"
      }
    ]
  }
}

B) Or

{
  "data": {
    "tables": [
      {
        "name": "BooksByAuthor"
      },
      {
        "name": "BooksByTitle"
      }
    ]
  }
}
@jorgebay
Copy link
Contributor Author

jorgebay commented Apr 1, 2020

I think the goal of those queries and mutations is to allow exploring whats in the DB, and it's not directly related to graphql types... I'm leaning towards option A.

@mpenick
Copy link
Contributor

mpenick commented Apr 9, 2020

What if we move the table DDL queries and mutations up to the root /graphql? Table DDL queries could be nested under the keyspaces as query-able tables/table fields. Table mutations would live at the top level, per GraphQL specification, but would take an extra keyspace parameter:

createTable(keyspace: "store", ...)

I think this could be a nice separation between DDL API and application-specific API. We'd have to modify or eliminate single keyspace mode.

@mpenick
Copy link
Contributor

mpenick commented Apr 9, 2020

It would potentially be easier to explain and document the different naming conventions if they live in different areas.

@jorgebay
Copy link
Contributor Author

jorgebay commented Apr 13, 2020

Table mutations would live at the top level, per GraphQL specification, but would take an extra keyspace parameter[...]

Altering the schema as a top level operation makes sense to me. To clarify, are you suggesting:

  • /graphql: DDL graphql operations. (createTable, createKeyspace, ...)
  • /graphql/<ks_name>: DML graphql operations for a single ks. (insertX, updateX, xFilter(), x()...)

What "single keyspace" setups (cloud) would look like? the same? for example /graphql and/graphql/my_ks ?

@jorgebay
Copy link
Contributor Author

This was implemented in #50 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants