Giter Site home page Giter Site logo

Manage JSONB fields about snowflaqe HOT 2 OPEN

gmlion avatar gmlion commented on June 12, 2024
Manage JSONB fields

from snowflaqe.

Comments (2)

Zaid-Ajaj avatar Zaid-Ajaj commented on June 12, 2024

Hi @gmlion,

Can you please provide a subset of your schema or your full schema from which the types are generated? If they are generated as optional fields, it means the hasura backend annotated them as such.

In postgres databases, assuming that is what you are working with in hasura, jsonb fields are just strings so it makes sense that they are saved as escaped strings. Since the data of JSONB fields can be of any shape, they are always serialized as strings and you are expected to deserialize them on the client side yourself.

from snowflaqe.

gmlion avatar gmlion commented on June 12, 2024

This is the schema portion about a JSONB field

{
              "name": "customData",
              "description": null,
              "args": [
                {
                  "name": "path",
                  "description": "JSON select path",
                  "type": {
                    "kind": "SCALAR",
                    "name": "String",
                    "ofType": null
                  },
                  "defaultValue": null
                }
              ],
              "type": {
                "kind": "NON_NULL",
                "name": null,
                "ofType": {
                  "kind": "SCALAR",
                  "name": "jsonb",
                  "ofType": null
                }
              },
              "isDeprecated": false,
              "deprecationReason": null
            }

Our issue is that inserting values using Snowflaqe they are inserted as json strings, and stored as such. Using other means, we can insert a string representing a json object and have it stored as such.
For example:

query {
  entity {
    json_data
  }
}

// response

{
  "data": {
    "entity": [
      {
        "json_data": {
          "mean": "not-snowflaqe"
        }
      },
      {
        "json_data": "{\"mean\":\"snowflaqe\"}"
      }
    ]
  }
}

from snowflaqe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.