You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2:56 PM <erikg> dat init; (env)% echo '{"hello": "world"}' | dat import --json
2:56 PM <erikg> % dat cat
2:56 PM <erikg> {"hello":"world","key":"ci0ps81a20000uia4ysz8957b","version":1}
2:57 PM <erikg> % echo '{"hellox":"worldz","key":"ci0ps81a20000uia4ysz8957b","version":2}' | dat import --json
2:57 PM <erikg> % dat cat
2:57 PM <erikg> {"hello":null,"hellox":"worldz","key":"ci0ps81a20000uia4ysz8957b","version":2}
2:57 PM <erikg> what i don't understand is why 'hello' is retained in the object
The reason for this behavior is that dat uses a schema to store data (using Protocol Buffers under the hood). When you write JSON it automatically adds any new keys to the schema. This is a pretty auto-magic process right now. To help demystify this we should add CLI APIs to view and edit the schema.
Strawman proposal:
dat schema would print a JSON version of the current protobuf schema
dat schema edit would open the schema in the default editor (similar to typing git commit)
also possibly dat schema import foo.json to let you supply your own schema from a file. Not sure the exact semantics of this one
also maybe we should by default write a message to stderr whenever the schema gets changed, just to make it more visible to the user that there is a schema under the hood
The text was updated successfully, but these errors were encountered:
inspired by a interaction with @ekg today in IRC:
The reason for this behavior is that dat uses a schema to store data (using Protocol Buffers under the hood). When you write JSON it automatically adds any new keys to the schema. This is a pretty auto-magic process right now. To help demystify this we should add CLI APIs to view and edit the schema.
Strawman proposal:
dat schema
would print a JSON version of the current protobuf schemadat schema edit
would open the schema in the default editor (similar to typinggit commit
)dat schema import foo.json
to let you supply your own schema from a file. Not sure the exact semantics of this oneThe text was updated successfully, but these errors were encountered: