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

dolt table import -r #86

Merged
merged 11 commits into from
Sep 21, 2019
Merged

dolt table import -r #86

merged 11 commits into from
Sep 21, 2019

Conversation

tbantle22
Copy link
Contributor

Fixes #76

Replaces existing table with the contents of the file while preserving the original schema

@tbantle22 tbantle22 added the enhancement New feature or request label Sep 20, 2019
@tbantle22 tbantle22 force-pushed the taylor/table-import-replace branch 2 times, most recently from ba00761 to 10aacb1 Compare September 20, 2019 17:15
Copy link
Contributor

@bheni bheni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these your first go changes? Looking pretty good! Most of the feedback comes down to how the verification is done. Take a look at my comments and let me know if you have any questions.

go/libraries/doltcore/mvdata/data_mover.go Outdated Show resolved Hide resolved
go/libraries/doltcore/mvdata/data_mover.go Outdated Show resolved Hide resolved
go/libraries/doltcore/mvdata/file_data_loc.go Outdated Show resolved Hide resolved
go/libraries/doltcore/table/untyped/xlsx/reader.go Outdated Show resolved Hide resolved
@@ -77,8 +77,13 @@ func NewJSONReader(nbf *types.NomsBinFormat, r io.ReadCloser, info *JSONFileInfo
return nil, err
}

ableToDecode := true
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was tricky to verify the schema for JSON because either a schema file is required or the schema from the existing table is used. When decoding the JSON rows here, an error is returned if the rows don't match the existing schema. This was not being handled before so I added an AbleToDecode property to JSONFileInfo that tracks whether the rows were decoded or not and can be used in the VerifySchema method. Let me know if you think there's a better way to do this - I couldn't directly compare the schemas here like I could for CSV and XLSX files.

Copy link
Contributor

@bheni bheni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

One thing I would ask is that you go and find all the VerifySchema declarations and add comments to them. We are trying to have comments on all exported methods in this codebase:

https://blog.golang.org/godoc-documenting-go-code

@tbantle22 tbantle22 merged commit fdd1e68 into master Sep 21, 2019
@tbantle22 tbantle22 deleted the taylor/table-import-replace branch September 21, 2019 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dolt table import -r
2 participants