Skip to content
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

Add option to generate “flat” column/attribute values #15

Open
kinghuang opened this issue Mar 14, 2017 · 0 comments
Open

Add option to generate “flat” column/attribute values #15

kinghuang opened this issue Mar 14, 2017 · 0 comments
Assignees

Comments

@kinghuang
Copy link

The json output format in Bottled Water is a literal json representation of an Avro formatted message. This can be highly inconvenient to parse. Here is an example of the current output.

{
  "id": {
    "long": 3688267
  },
  "language": {
    "string": "en_US"
  },
  "created": {
    "DateTime": {
      "year": "2017",
      "month": "03",
      "date": "14",
      "hour": "15",
      "minute": "42",
      "second": "49",
      "micro": "230990"
    }
  }
}

In the example, the value of each attribute (id, language, and created) is a dict with one item whose key is the value type, and value is the actual value. This requires readers to either know ahead of time what the value type of each attribute is in order to get the underlying value, or infer the value key by iterating or searching over the dict.

It would be convenient if there is an option to directly emit the value of each attribute, like the following.

{
  "id": 3688267,
  "language": "en_US",
  "created": {
    "year": "2017",
    "month": "03",
    "date": "14",
    "hour": "15",
    "minute": "42",
    "second": "49",
    "micro": "230990"
  }
}

Or, if it is desirable to preserve the type information, organize it as a list/array/tuple, so that it is easy to get the type and underlying value without needing fore-knowledge or potentially expensive operations over dict.

{
  "id": ["long", 3688267],
  "language": ["string", "en_US"],
  "created": ["DateTime", {
    "year": "2017",
    "month": "03",
    "date": "14",
    "hour": "15",
    "minute": "42",
    "second": "49",
    "micro": "230990"
  }]
}
@kinghuang kinghuang self-assigned this Mar 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant