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
Google Sheet Connector #16721
Google Sheet Connector #16721
Conversation
@chliang71 Could you add Co-authors? Thanks |
Thanks for the catch, added co-author and the Trino PR to the commit message |
Hi @xumingming, hope you are doing good. Do you think you can review this PR? Thanks! |
Friendly ping @xumingming @tdcmeehan mind reviewing this PR? Thanks! |
Hey @chliang71, it's really a great feature, thanks a lot for your contribution! generally it looks good to me. But the credential file path is hard coded which break the tests. could you fix it?
presto-google-sheets/pom.xml
Outdated
</dependency> | ||
</dependencies> | ||
|
||
</project> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new line at the end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @chliang71, I think we need a new-line at the end of this pom file just like other connectors.
presto-google-sheets/src/main/java/com/facebook/presto/google/sheets/SheetsMetadata.java
Outdated
Show resolved
Hide resolved
presto-google-sheets/src/main/java/com/facebook/presto/google/sheets/SheetsMetadata.java
Outdated
Show resolved
Hide resolved
presto-google-sheets/src/test/java/com/facebook/presto/google/sheets/TestSheetsPlugin.java
Outdated
Show resolved
Hide resolved
public class TestSheetsPlugin | ||
{ | ||
//static final String TEST_METADATA_SHEET_ID = "1Es4HhWALUQjoa-bQh4a8B5HROz7dpGMfq_HbfoaW5LM#Tables"; | ||
static final String TEST_METADATA_SHEET_ID = "1qDMzfuAFE60h2_kKrPwz0S-oaJ23Gy9iGBHZZbulY1o#Tables"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where is this sheet id coming from? is it a sheet to public?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes this is a public sheet that was created to test this from Trino. I'm reusing the sheet. In production though, users should create their own metadata sheet with right perm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dnQ2YUc4K282Q0JaTitPS2tPdmdNSWNNdGxsWlpPWTlMVDI1ejlVdXhwNVdIYjh6aGNcbktSSzBxejRkZVBXaUkvS0ozQWdwUk5pZDVMQ25BdjF2RGJTU243enJBb0dBV3lJMWJBWWoyTjJHVHFvQ1ovdmhcbjhIeWdrYVY1TGxZQlBpTVd5YzM0cW5MUmFIamxFc2FTZVRVcWxBUFp1UTB2Umk1NXpDZzJXWFAzOHYvNjk4ekxcbi9meXFZM2ZpY2hNV05SVzRrbWRCdWJPQWdKbFJmOFp3cDJPd1JicVgwU3FtWkVjc3I4ekNISysvN1huMTRzWGpcbkdzbGVRNnpFU05sNkk3RjFXOW02a0g0PVxuLS0tLS1FTkQgUFJJVkFURSBLRVktLS0tLVxuIiwKICAiY2xpZW50X2VtYWlsIjogInByZXN0b3Rlc3RAcHJlc3RvdGVzdC5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSIsCiAgImNsaWVudF9pZCI6ICIxMTY5ODUyMjI4NTIxODQzNzYyOTMiLAogICJhdXRoX3VyaSI6ICJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20vby9vYXV0aDIvYXV0aCIsCiAgInRva2VuX3VyaSI6ICJodHRwczovL29hdXRoMi5nb29nbGVhcGlzLmNvbS90b2tlbiIsCiAgImF1dGhfcHJvdmlkZXJfeDUwOV9jZXJ0X3VybCI6ICJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9vYXV0aDIvdjEvY2VydHMiLAogICJjbGllbnRfeDUwOV9jZXJ0X3VybCI6ICJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9yb2JvdC92MS9tZXRhZGF0YS94NTA5L3ByZXN0b3Rlc3QlNDBwcmVzdG90ZXN0LmlhbS5nc2VydmljZWFjY291bnQuY29tIgp9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there an account for this credential? who is the owner of this credential?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the credential for that public testing sheet, it is an encrypted credential. Not sure about the owner, but most likely @punit.kj from the Trinodb PR. This is just for testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, can we create a new one or reuse the credential of the big-query connector (if there is one)? Thanks!
presto-google-sheets/src/test/java/com/facebook/presto/google/sheets/TestSheetsConfig.java
Outdated
Show resolved
Hide resolved
presto-google-sheets/src/test/java/com/facebook/presto/google/sheets/TestGoogleSheets.java
Outdated
Show resolved
Hide resolved
Also could you update the commit message following the pattern below? thanks!
Fix OOM caused by foo in bar
Foo was pack ratting ByteBuffers causing OOM.
Cherry-pick of https://github.com/foo/bar/pull/123 (https://github.com/foo/bar/pull/123)
Co-authored-by: Foo Bar <foo@bar.com>
@ChunxuTang could you also take a look? I think this connector is also great for twitter's use case. Thanks! |
@beinan Sure, I'm glad to help with a review! This feature looks nice to Twitter.
@chliang71 Thanks so much for your nice work! I left some comments, mainly concentrating on coding styles. Moreover, as this is a new connector, could you create a document and add it to the presto-docs
folder?
Thanks! Looking forward to deploying this feature in Twitter!
presto-google-sheets/src/main/java/com/facebook/presto/google/sheets/SheetsClient.java
Show resolved
Hide resolved
presto-google-sheets/src/main/java/com/facebook/presto/google/sheets/SheetsClient.java
Show resolved
Hide resolved
presto-google-sheets/src/main/java/com/facebook/presto/google/sheets/SheetsConfig.java
Show resolved
Hide resolved
presto-google-sheets/src/main/java/com/facebook/presto/google/sheets/SheetsConfig.java
Show resolved
Hide resolved
presto-google-sheets/src/main/java/com/facebook/presto/google/sheets/SheetsModule.java
Show resolved
Hide resolved
20ccff7
to
f7df421
Compare
@chliang71 could you rebase master? Thank you! looks like there is a git conflict
@@ -0,0 +1 @@ | |||
ewogICJ0eXBlIjogInNlcnZpY2VfYWNjb3VudCIsCiAgInByb2plY3RfaWQiOiAicHJlc3RvdGVzdCIsCiAgInByaXZhdGVfa2V5X2lkIjogIjgwN2M3OTBiZjAwNTY1Mzg1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ovdmhcbjhIeWdrYVY1TGxZQlBpTVd5YzM0cW5MUmFIamxFc2FTZVRVcWxBUFp1UTB2Umk1NXpDZzJXWFAzOHYvNjk4ekxcbi9meXFZM2ZpY2hNV05SVzRrbWRCdWJPQWdKbFJmOFp3cDJPd1JicVgwU3FtWkVjc3I4ekNISysvN1huMTRzWGpcbkdzbGVRNnpFU05sNkk3RjFXOW02a0g0PVxuLS0tLS1FTkQgUFJJVkFURSBLRVktLS0tLVxuIiwKICAiY2xpZW50X2VtYWlsIjogInByZXN0b3Rlc3RAcHJlc3RvdGVzdC5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSIsCiAgImNsaWVudF9pZCI6ICIxMTY5ODUyMjI4NTIxODQzNzYyOTMiLAogICJhdXRoX3VyaSI6ICJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20vby9vYXV0aDIvYXV0aCIsCiAgInRva2VuX3VyaSI6ICJodHRwczovL29hdXRoMi5nb29nbGVhcGlzLmNvbS90b2tlbiIsCiAgImF1dGhfcHJvdmlkZXJfeDUwOV9jZXJ0X3VybCI6ICJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9vYXV0aDIvdjEvY2VydHMiLAogICJjbGllbnRfeDUwOV9jZXJ0X3VybCI6ICJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9yb2JvdC92MS9tZXRhZGF0YS94NTA5L3ByZXN0b3Rlc3QlNDBwcmVzdG90ZXN0LmlhbS5nc2VydmljZWFjY291bnQuY29tIgp9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, can we create a new one or reuse the credential of the big-query connector (if there is one)? Thanks!
@chliang71
Reviewed the PR again for the docs. The documentation looks great to me!
Thanks for the reviews!! @beinan @ChunxuTang . I have rebased to the master, and have updated the commit message. Please let me know if any other comments. |
my concern is still the credential stored in presto-google-sheets/src/test/resources/gsheets-creds-base64-encoded.props
. I think the owner of this credential is prestosqltest@gmail.com. Also there is a rate limit on this credential, not sure if it will cause any issue if we're this one for the both two presto projects. can we create a new credential under prestodbtest@gmail.com? I can share you the password of this google account offline if you need it.
If there is another more fitting credential to use then definitely we can go for it. Thanks. |
08043c1
to
8424e38
Compare
@beinan I have updated to use the prestodbtest account, and have recreated the metadata sheet for presto db. Please take a look when you get a chance. Thanks!! |
Looks good to me except we should add a new-line at the end of the pom file you newly added.
Also, could you refine the commit message a little bit as https://chris.beams.io/posts/git-commit/ suggested? thanks!
presto-google-sheets/pom.xml
Outdated
</dependency> | ||
</dependencies> | ||
|
||
</project> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @chliang71, I think we need a new-line at the end of this pom file just like other connectors.
3cdbaea
to
137590a
Compare
Thanks for the review @beinan !! I have updated the PR (commit message and pom). But for some reason, although my local build worked fine, the maven check is failing... Please let me know if other changes needed. Thanks! |
I see, the current version is '0.267-SNAPSHOT' but the pom you just added is still on 0.266-SNAPSHOT
@chliang71 could you please rebase and update the version? Thanks! |
This change introduces Google sheet connector. This change is largely cherry-picked from TrinoDB (trino#1030) and rebased into Presto. Please note that this change introduces only the query/read functionality of data from existing Google sheets, and does not currently support insert/write into Google sheets. cherry-pick of trinodb/trino#1030 Co-authored-by: Puneet Jaiswal <punit.kj@gmail.com>
Thanks for checking @beinan , good catch! I updated the pom to 267, now the majority of the checks are passing. But still two test failures
But I don't see how these two tests can be related to my change... also, when I ran these two tests locally, they both passed. |
rerun the ci, let's wait and see |
@beinan We are seeing some unit test failures. "Expected exception message 'Failed reading data from sheet: 1fu6qjHrOARa7Rqezfgd9C--XPCUOkN_vhvwpxZ4INGE#Tables' to match 'Sheet expression not found for table foo_bar_table' for query: select * from gsheets.default.foo_bar_table" is a sample error message. Can you please take a look and fix them. Builds are broken due to this. |
@varungajjala Sure, is this one just flaky or failed all the time? @chliang71 could you also help? thanks! |
@varungajjala I just posted a pr to disable the test: #17052 Looks like these tests are visiting the google service via internet, which I guess would make the test very flaky in poor network environment. I think we could not re-enable these test until we're able to mock the google sheet service. @chliang71 what do you think? |
Trino has introduced google sheet connector in this PR.
Note that currently Trino google sheet connector only supports read queries, and doesn't support inserts.
This open WIP PR in Trino attempts to add insert functionality. I plan to follow up in next PR.
Related ticket #16516