1

I have a question,

I can't assign json schema for the json files I want to upload to BigQuery because I have a @ in my field name.

"Events": {
  "type": "object",
  "properties": {
    "Event": {
      "type": "object",
      "properties": {
        "@places": {
          "type": "object",
          "properties": {
            "id": {
              "type": "integer"
            },
            "comp_id": {
              "type": "string"
            },
            "manager_id": {
              "type": "integer"
            },
            "price": {
              "type": "integer"
            },
            "size": {
              "type": "integer"
            },
            "location": {
              "type": "integer"
            },
            "date": {
              "type": "object",
              "properties": {
                "locale": {
                  "type": "string"

2 Answers2

0

Although any string that you put in a JSON key is valid, see also Q: Which characters are valid/invalid in a JSON key name?, the consumers of the data may have specific requirements that this is actually not allowed.

In your case, where BigQuery is the consumer, it might just be that it doesn't accept certain characters. If this is the case, there is no other alternative than to remove the special characters, in your case '@', from your schema.

Community
  • 1
  • 1
Juliën
  • 9,047
  • 7
  • 49
  • 80
0

Fields in your JSON file will be loaded as fields in a BigQuery table. @ is not allowed in field names for BigQuery tables, so you cannot use it in your JSON file.

From the BQ documentation:

The name must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_), and must start with a letter or underscore. The maximum length is 128 characters.

Hua Zhang
  • 1,521
  • 11
  • 11
  • A link to the Google docs for this would be nice. I'd suggest adding a link any time you quote a source from the internet. – Josh Brown Sep 10 '19 at 16:13