You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by GitBox <gi...@apache.org> on 2022/09/20 17:09:14 UTC

[GitHub] [incubator-devlake] keon94 opened a new pull request, #3151: [issue-3123] Singer spec POC

keon94 opened a new pull request, #3151:
URL: https://github.com/apache/incubator-devlake/pull/3151

   ### ⚠️ Pre Checklist
   
   > Please complete _ALL_ items in this checklist, and remove before submitting
   
   - [ ] I have read through the [Contributing Documentation](https://devlake.apache.org/community/).
   - [ ] I have added relevant tests.
   - [ ] I have added relevant documentation.
   - [ ] I will add labels to the PR, such as `pr-type/bug-fix`, `pr-type/feature-development`, etc.
   
   
   
   # Summary
   
   <!--
   Thanks for submitting a pull request!
   
   We appreciate you spending the time to work on these changes.
   Please fill out as many sections below as possible.
   -->
   
   ### Does this close any open issues?
   Closes #3123 
   
   ### Screenshots
   Include any relevant screenshots here.
   
   ### Other Information
   Any other information that is important to this PR.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] klesh commented on a diff in pull request #3151: [issue-3123][backend] Singer-spec framework support

Posted by GitBox <gi...@apache.org>.
klesh commented on code in PR #3151:
URL: https://github.com/apache/incubator-devlake/pull/3151#discussion_r999439811


##########
plugins/core/tap/singer_impl.go:
##########
@@ -0,0 +1,196 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package tap
+
+import (
+	"bufio"
+	"encoding/json"
+	"github.com/apache/incubator-devlake/config"
+	"github.com/apache/incubator-devlake/errors"
+	"github.com/mitchellh/hashstructure"
+	"os"
+	"os/exec"
+	"path/filepath"
+)
+
+type (
+	SingerTapImpl struct {
+		*SingerTapConfig
+		cmd            string
+		name           string
+		tempLocation   string
+		propertiesFile *fileData[SingerTapProperties]
+		stateFile      *fileData[[]byte]
+		configFile     *fileData[[]byte]
+	}
+	fileData[Content any] struct {
+		path    string
+		content *Content
+	}
+)
+
+func NewSingerTap(cfg *SingerTapConfig) (*SingerTapImpl, errors.Error) {

Review Comment:
   The one located in the project root folder, there are 2 implementations already, `dalgorm` and `migration`.
   They both implemented the `interfaces` defined in `core` package.
   In this way, we can separate the contract from the concrete implementation, which helps us avoid importing 3rd libraries directly into our system and writing test cases among other benefits.
   Generic or not doesn't matter, we don't plan to implement another specific `migration` or `dal` as well.
   
   Come to think about it, maybe `helpers/pluginhelper/tap` is a more appropriate place to be.
   I think the whole `singer` feature is not the `core` of our system, it is sth we offer to developers, they could choose to use RESTful API or use `singer`, so, no, they should not be in the `core` package.
   
   Take a look at the `plugins/helper` which contains all RESTFul helpers we offer for plugin developers, it was put into a separate package apart from the `core` package as an optional feature. I think the `singer` should do the same, except the existing `plugins/helper` will be moved to `helpers/pluginhelper/restful`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] keon94 commented on a diff in pull request #3151: [issue-3123][backend] Singer-spec framework support

Posted by GitBox <gi...@apache.org>.
keon94 commented on code in PR #3151:
URL: https://github.com/apache/incubator-devlake/pull/3151#discussion_r999881294


##########
plugins/core/tap/singer_impl.go:
##########
@@ -0,0 +1,196 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package tap
+
+import (
+	"bufio"
+	"encoding/json"
+	"github.com/apache/incubator-devlake/config"
+	"github.com/apache/incubator-devlake/errors"
+	"github.com/mitchellh/hashstructure"
+	"os"
+	"os/exec"
+	"path/filepath"
+)
+
+type (
+	SingerTapImpl struct {
+		*SingerTapConfig
+		cmd            string
+		name           string
+		tempLocation   string
+		propertiesFile *fileData[SingerTapProperties]
+		stateFile      *fileData[[]byte]
+		configFile     *fileData[[]byte]
+	}
+	fileData[Content any] struct {
+		path    string
+		content *Content
+	}
+)
+
+func NewSingerTap(cfg *SingerTapConfig) (*SingerTapImpl, errors.Error) {

Review Comment:
   Ok, good idea. Wouldn't `helpers/restful` and `helpers/tap` be sufficient? Because they're already in the plugins parent directory.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] keon94 commented on a diff in pull request #3151: [issue-3123][backend] Singer-spec framework support

Posted by GitBox <gi...@apache.org>.
keon94 commented on code in PR #3151:
URL: https://github.com/apache/incubator-devlake/pull/3151#discussion_r1008644901


##########
plugins/helper/batch_save_divider.go:
##########
@@ -35,11 +35,12 @@ type BatchSaveDivider struct {
 	db        dal.Dal
 	batches   map[reflect.Type]*BatchSave
 	batchSize int
-	table     string
-	params    string
+	rawTable  string

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] klesh commented on a diff in pull request #3151: [issue-3123][backend] Singer-spec framework support

Posted by GitBox <gi...@apache.org>.
klesh commented on code in PR #3151:
URL: https://github.com/apache/incubator-devlake/pull/3151#discussion_r1000094792


##########
plugins/core/tap/singer_impl.go:
##########
@@ -0,0 +1,196 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package tap
+
+import (
+	"bufio"
+	"encoding/json"
+	"github.com/apache/incubator-devlake/config"
+	"github.com/apache/incubator-devlake/errors"
+	"github.com/mitchellh/hashstructure"
+	"os"
+	"os/exec"
+	"path/filepath"
+)
+
+type (
+	SingerTapImpl struct {
+		*SingerTapConfig
+		cmd            string
+		name           string
+		tempLocation   string
+		propertiesFile *fileData[SingerTapProperties]
+		stateFile      *fileData[[]byte]
+		configFile     *fileData[[]byte]
+	}
+	fileData[Content any] struct {
+		path    string
+		content *Content
+	}
+)
+
+func NewSingerTap(cfg *SingerTapConfig) (*SingerTapImpl, errors.Error) {

Review Comment:
   I'm planning to move `plugins/helpers` to `helpers/pluginhelper` according to #2078 .
   It would be helpful if you place the `tap` there.
   `helpers` and `core` were put into `plugins/` folder without much consideration, they shouldn't be there, because, obviously, they are not plugin 😂



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] keon94 commented on pull request #3151: [issue-3123][backend] Singer-spec framework support

Posted by GitBox <gi...@apache.org>.
keon94 commented on PR #3151:
URL: https://github.com/apache/incubator-devlake/pull/3151#issuecomment-1294404057

   Sample collection raw later:
   ![image](https://user-images.githubusercontent.com/25063936/198495832-5c2707b1-5ffd-4d4c-810d-3d9d8ba414d7.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] keon94 commented on a diff in pull request #3151: [issue-3123][backend] Singer-spec framework support

Posted by GitBox <gi...@apache.org>.
keon94 commented on code in PR #3151:
URL: https://github.com/apache/incubator-devlake/pull/3151#discussion_r998773204


##########
plugins/core/tap/singer_impl.go:
##########
@@ -0,0 +1,196 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package tap
+
+import (
+	"bufio"
+	"encoding/json"
+	"github.com/apache/incubator-devlake/config"
+	"github.com/apache/incubator-devlake/errors"
+	"github.com/mitchellh/hashstructure"
+	"os"
+	"os/exec"
+	"path/filepath"
+)
+
+type (
+	SingerTapImpl struct {
+		*SingerTapConfig
+		cmd            string
+		name           string
+		tempLocation   string
+		propertiesFile *fileData[SingerTapProperties]
+		stateFile      *fileData[[]byte]
+		configFile     *fileData[[]byte]
+	}
+	fileData[Content any] struct {
+		path    string
+		content *Content
+	}
+)
+
+func NewSingerTap(cfg *SingerTapConfig) (*SingerTapImpl, errors.Error) {

Review Comment:
   Which impl package? This is not a specific tap, but a generic one



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] keon94 commented on a diff in pull request #3151: [issue-3123][backend] Singer-spec framework support

Posted by GitBox <gi...@apache.org>.
keon94 commented on code in PR #3151:
URL: https://github.com/apache/incubator-devlake/pull/3151#discussion_r999881294


##########
plugins/core/tap/singer_impl.go:
##########
@@ -0,0 +1,196 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package tap
+
+import (
+	"bufio"
+	"encoding/json"
+	"github.com/apache/incubator-devlake/config"
+	"github.com/apache/incubator-devlake/errors"
+	"github.com/mitchellh/hashstructure"
+	"os"
+	"os/exec"
+	"path/filepath"
+)
+
+type (
+	SingerTapImpl struct {
+		*SingerTapConfig
+		cmd            string
+		name           string
+		tempLocation   string
+		propertiesFile *fileData[SingerTapProperties]
+		stateFile      *fileData[[]byte]
+		configFile     *fileData[[]byte]
+	}
+	fileData[Content any] struct {
+		path    string
+		content *Content
+	}
+)
+
+func NewSingerTap(cfg *SingerTapConfig) (*SingerTapImpl, errors.Error) {

Review Comment:
   Ok, good idea. Wouldn't `helpers/restful` and `helpers/singer` not sufficient? Because they're already in the plugins parent directory.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] klesh merged pull request #3151: [issue-3123][backend] Singer-spec framework support

Posted by GitBox <gi...@apache.org>.
klesh merged PR #3151:
URL: https://github.com/apache/incubator-devlake/pull/3151


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] keon94 commented on a diff in pull request #3151: [issue-3123][backend] Singer-spec framework support

Posted by GitBox <gi...@apache.org>.
keon94 commented on code in PR #3151:
URL: https://github.com/apache/incubator-devlake/pull/3151#discussion_r1013238379


##########
plugins/helper/api_rawdata.go:
##########
@@ -52,11 +52,12 @@ type RawDataSubTaskArgs struct {
 // RawDataSubTask is Common features for raw data sub-tasks
 type RawDataSubTask struct {
 	args   *RawDataSubTaskArgs
-	table  string
-	params string
+	Table  string

Review Comment:
   I think moving this file to a new package is a good idea, but that'll end up touching a lot of different files . I think for now I'll just add Getter methods to this struct and make the fields private again to keep this PR simple.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] keon94 commented on pull request #3151: [issue-3123:backend] Singer-spec framework support

Posted by GitBox <gi...@apache.org>.
keon94 commented on PR #3151:
URL: https://github.com/apache/incubator-devlake/pull/3151#issuecomment-1278359295

   POC plugin implementations moved to https://github.com/merico-dev/lake/tree/issues/3123-poc


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] keon94 commented on a diff in pull request #3151: [issue-3123][backend] Singer-spec framework support

Posted by GitBox <gi...@apache.org>.
keon94 commented on code in PR #3151:
URL: https://github.com/apache/incubator-devlake/pull/3151#discussion_r999881294


##########
plugins/core/tap/singer_impl.go:
##########
@@ -0,0 +1,196 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package tap
+
+import (
+	"bufio"
+	"encoding/json"
+	"github.com/apache/incubator-devlake/config"
+	"github.com/apache/incubator-devlake/errors"
+	"github.com/mitchellh/hashstructure"
+	"os"
+	"os/exec"
+	"path/filepath"
+)
+
+type (
+	SingerTapImpl struct {
+		*SingerTapConfig
+		cmd            string
+		name           string
+		tempLocation   string
+		propertiesFile *fileData[SingerTapProperties]
+		stateFile      *fileData[[]byte]
+		configFile     *fileData[[]byte]
+	}
+	fileData[Content any] struct {
+		path    string
+		content *Content
+	}
+)
+
+func NewSingerTap(cfg *SingerTapConfig) (*SingerTapImpl, errors.Error) {

Review Comment:
   Ok, good idea. Wouldn't `helpers/restful` and `helpers/tap` not sufficient? Because they're already in the plugins parent directory.



##########
plugins/core/tap/singer_impl.go:
##########
@@ -0,0 +1,196 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package tap
+
+import (
+	"bufio"
+	"encoding/json"
+	"github.com/apache/incubator-devlake/config"
+	"github.com/apache/incubator-devlake/errors"
+	"github.com/mitchellh/hashstructure"
+	"os"
+	"os/exec"
+	"path/filepath"
+)
+
+type (
+	SingerTapImpl struct {
+		*SingerTapConfig
+		cmd            string
+		name           string
+		tempLocation   string
+		propertiesFile *fileData[SingerTapProperties]
+		stateFile      *fileData[[]byte]
+		configFile     *fileData[[]byte]
+	}
+	fileData[Content any] struct {
+		path    string
+		content *Content
+	}
+)
+
+func NewSingerTap(cfg *SingerTapConfig) (*SingerTapImpl, errors.Error) {

Review Comment:
   Ok, good idea. Wouldn't `helpers/restful` and `helpers/tap` not be sufficient? Because they're already in the plugins parent directory.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] keon94 commented on a diff in pull request #3151: [issue-3123][backend] Singer-spec framework support

Posted by GitBox <gi...@apache.org>.
keon94 commented on code in PR #3151:
URL: https://github.com/apache/incubator-devlake/pull/3151#discussion_r999979185


##########
plugins/core/tap/singer_models.go:
##########
@@ -0,0 +1,45 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package tap
+
+// singer-tap specific types
+type (
+	// SingerTapSchema the structure of this is determined by the catalog/properties JSON of a singer tap
+	SingerTapSchema map[string]interface{}

Review Comment:
   I've kept them under helper/tap because these are mostly helper models, not high level models like the ones in that package



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] keon94 commented on pull request #3151: [issue-3123][backend] Singer-spec framework support

Posted by GitBox <gi...@apache.org>.
keon94 commented on PR #3151:
URL: https://github.com/apache/incubator-devlake/pull/3151#issuecomment-1296381930

   Sample collector usage:
   ![image](https://user-images.githubusercontent.com/25063936/198907934-6e6cb083-ae15-45b2-89e9-950549032337.png)
   Sample plugin impl usage:
   ![image](https://user-images.githubusercontent.com/25063936/198907967-50bab2d7-ced5-4cc3-88aa-7931b436cd4d.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] keon94 closed pull request #3151: [issue-3123] Singer spec POC

Posted by GitBox <gi...@apache.org>.
keon94 closed pull request #3151: [issue-3123] Singer spec POC
URL: https://github.com/apache/incubator-devlake/pull/3151


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] keon94 commented on pull request #3151: [issue-3123][backend] Singer-spec framework support

Posted by GitBox <gi...@apache.org>.
keon94 commented on PR #3151:
URL: https://github.com/apache/incubator-devlake/pull/3151#issuecomment-1283088440

   > I have some questions:
   > 
   > 1. Do we have the progress update for this kind of subtasks?
   > 2. Can we cancel the operation?
   > 3. Can we collect the error message reported by the tap
   > 4. Should we update the `Dockerfile` to include the `tap` binary?
   
   1. Yes See [this](https://github.com/apache/incubator-devlake/pull/3151/files#diff-77ec73334c6c15e351538bd12467875fa40665d75beb11627899363e071b7668R154)
   2. Yes. See [this](https://github.com/apache/incubator-devlake/pull/3151/files#diff-77ec73334c6c15e351538bd12467875fa40665d75beb11627899363e071b7668R140)
   3. Yes. Stderr of the tap is captured in the error
   4. Once we support concrete taps in future tickets. At this moment, no.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] klesh commented on a diff in pull request #3151: [issue-3123][backend] Singer-spec framework support

Posted by GitBox <gi...@apache.org>.
klesh commented on code in PR #3151:
URL: https://github.com/apache/incubator-devlake/pull/3151#discussion_r997866613


##########
plugins/core/tap/singer_impl.go:
##########
@@ -0,0 +1,196 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package tap
+
+import (
+	"bufio"
+	"encoding/json"
+	"github.com/apache/incubator-devlake/config"
+	"github.com/apache/incubator-devlake/errors"
+	"github.com/mitchellh/hashstructure"
+	"os"
+	"os/exec"
+	"path/filepath"
+)
+
+type (
+	SingerTapImpl struct {
+		*SingerTapConfig
+		cmd            string
+		name           string
+		tempLocation   string
+		propertiesFile *fileData[SingerTapProperties]
+		stateFile      *fileData[[]byte]
+		configFile     *fileData[[]byte]
+	}
+	fileData[Content any] struct {
+		path    string
+		content *Content
+	}
+)
+
+func NewSingerTap(cfg *SingerTapConfig) (*SingerTapImpl, errors.Error) {

Review Comment:
   Please do NOT put implementation under `core`, move it to `impl/tap`



##########
models/migrationscripts/20221015_create_singer_state.go:
##########
@@ -0,0 +1,57 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package migrationscripts
+
+import (
+	"context"
+	"github.com/apache/incubator-devlake/errors"
+	"gorm.io/datatypes"
+	"gorm.io/gorm"
+	"time"
+)
+
+type createTapState struct{}
+
+type SingerTapState20221015 struct {

Review Comment:
   Where is the final `model struct` located?



##########
plugins/core/tap/singer_models.go:
##########
@@ -0,0 +1,45 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package tap
+
+// singer-tap specific types
+type (
+	// SingerTapSchema the structure of this is determined by the catalog/properties JSON of a singer tap
+	SingerTapSchema map[string]interface{}

Review Comment:
   Please move it to `models` if they are



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] keon94 commented on a diff in pull request #3151: [issue-3123][backend] Singer-spec framework support

Posted by GitBox <gi...@apache.org>.
keon94 commented on code in PR #3151:
URL: https://github.com/apache/incubator-devlake/pull/3151#discussion_r1001120153


##########
plugins/core/tap/singer_impl.go:
##########
@@ -0,0 +1,196 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package tap
+
+import (
+	"bufio"
+	"encoding/json"
+	"github.com/apache/incubator-devlake/config"
+	"github.com/apache/incubator-devlake/errors"
+	"github.com/mitchellh/hashstructure"
+	"os"
+	"os/exec"
+	"path/filepath"
+)
+
+type (
+	SingerTapImpl struct {
+		*SingerTapConfig
+		cmd            string
+		name           string
+		tempLocation   string
+		propertiesFile *fileData[SingerTapProperties]
+		stateFile      *fileData[[]byte]
+		configFile     *fileData[[]byte]
+	}
+	fileData[Content any] struct {
+		path    string
+		content *Content
+	}
+)
+
+func NewSingerTap(cfg *SingerTapConfig) (*SingerTapImpl, errors.Error) {

Review Comment:
   Done.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] klesh commented on a diff in pull request #3151: [issue-3123][backend] Singer-spec framework support

Posted by GitBox <gi...@apache.org>.
klesh commented on code in PR #3151:
URL: https://github.com/apache/incubator-devlake/pull/3151#discussion_r1012669052


##########
plugins/helper/api_rawdata.go:
##########
@@ -52,11 +52,12 @@ type RawDataSubTaskArgs struct {
 // RawDataSubTask is Common features for raw data sub-tasks
 type RawDataSubTask struct {
 	args   *RawDataSubTaskArgs
-	table  string
-	params string
+	Table  string

Review Comment:
   The reason these Fields are private is they should not be modified after initialization.
   Any accidental modified can cause bugs.
   
   Maybe we should move this file to `models` module since it is part of the infrastructure of the framework and shared by different helpers and change these Fields to Methods to avoid modification.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] keon94 commented on a diff in pull request #3151: [issue-3123][backend] Singer-spec framework support

Posted by GitBox <gi...@apache.org>.
keon94 commented on code in PR #3151:
URL: https://github.com/apache/incubator-devlake/pull/3151#discussion_r1008644752


##########
models/migrationscripts/20221015_create_singer_state.go:
##########
@@ -0,0 +1,56 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package migrationscripts
+
+import (
+	"github.com/apache/incubator-devlake/errors"
+	"github.com/apache/incubator-devlake/plugins/core"
+	"gorm.io/datatypes"
+	"time"
+)
+
+type createTapState struct{}
+
+type SingerTapState20221015 struct {
+	Id           string `gorm:"primaryKey;type:varchar(255)"`
+	ConnectionId uint64
+	Type         string
+	Value        datatypes.JSON
+	CreatedAt    time.Time
+	UpdatedAt    time.Time
+}
+
+func (SingerTapState20221015) TableName() string {
+	return "tap_state"
+}
+
+func (*createTapState) Up(basicRes core.BasicRes) errors.Error {
+	err := basicRes.GetDal().AutoMigrate(SingerTapState20221015{})
+	if err != nil {
+		return errors.Convert(err)

Review Comment:
   Done



##########
models/migrationscripts/20221015_create_singer_state.go:
##########
@@ -0,0 +1,56 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package migrationscripts
+
+import (
+	"github.com/apache/incubator-devlake/errors"
+	"github.com/apache/incubator-devlake/plugins/core"
+	"gorm.io/datatypes"
+	"time"
+)
+
+type createTapState struct{}
+
+type SingerTapState20221015 struct {
+	Id           string `gorm:"primaryKey;type:varchar(255)"`
+	ConnectionId uint64
+	Type         string
+	Value        datatypes.JSON
+	CreatedAt    time.Time
+	UpdatedAt    time.Time
+}
+
+func (SingerTapState20221015) TableName() string {
+	return "tap_state"

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] keon94 commented on pull request #3151: [issue-3123][backend] Singer-spec framework support

Posted by GitBox <gi...@apache.org>.
keon94 commented on PR #3151:
URL: https://github.com/apache/incubator-devlake/pull/3151#issuecomment-1295690546

   New state table after revisions (cc @CamilleTeruel)
   ![image](https://user-images.githubusercontent.com/25063936/198769929-2a3181bb-d9bf-4787-a5e3-aa62f3c63f5e.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] keon94 commented on a diff in pull request #3151: [issue-3123][backend] Singer-spec framework support

Posted by GitBox <gi...@apache.org>.
keon94 commented on code in PR #3151:
URL: https://github.com/apache/incubator-devlake/pull/3151#discussion_r999980024


##########
plugins/core/tap/singer_impl.go:
##########
@@ -0,0 +1,196 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package tap
+
+import (
+	"bufio"
+	"encoding/json"
+	"github.com/apache/incubator-devlake/config"
+	"github.com/apache/incubator-devlake/errors"
+	"github.com/mitchellh/hashstructure"
+	"os"
+	"os/exec"
+	"path/filepath"
+)
+
+type (
+	SingerTapImpl struct {
+		*SingerTapConfig
+		cmd            string
+		name           string
+		tempLocation   string
+		propertiesFile *fileData[SingerTapProperties]
+		stateFile      *fileData[[]byte]
+		configFile     *fileData[[]byte]
+	}
+	fileData[Content any] struct {
+		path    string
+		content *Content
+	}
+)
+
+func NewSingerTap(cfg *SingerTapConfig) (*SingerTapImpl, errors.Error) {

Review Comment:
   I only made helpers/tap to keep this PR focused on just the new stuff. We can have another refactor PR to move the existing src files to helpers/restful (and update the generator)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] keon94 commented on a diff in pull request #3151: [issue-3123][backend] Singer-spec framework support

Posted by GitBox <gi...@apache.org>.
keon94 commented on code in PR #3151:
URL: https://github.com/apache/incubator-devlake/pull/3151#discussion_r998773660


##########
models/migrationscripts/20221015_create_singer_state.go:
##########
@@ -0,0 +1,57 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package migrationscripts
+
+import (
+	"context"
+	"github.com/apache/incubator-devlake/errors"
+	"gorm.io/datatypes"
+	"gorm.io/gorm"
+	"time"
+)
+
+type createTapState struct{}
+
+type SingerTapState20221015 struct {

Review Comment:
   [here](https://github.com/apache/incubator-devlake/pull/3151/files#diff-c1a46698f48456226e901578ec4d6bce4049b1c4c923b574300f3a5d60399abeR50)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] klesh commented on a diff in pull request #3151: [issue-3123][backend] Singer-spec framework support

Posted by GitBox <gi...@apache.org>.
klesh commented on code in PR #3151:
URL: https://github.com/apache/incubator-devlake/pull/3151#discussion_r1004275031


##########
models/migrationscripts/20221015_create_singer_state.go:
##########
@@ -0,0 +1,56 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package migrationscripts
+
+import (
+	"github.com/apache/incubator-devlake/errors"
+	"github.com/apache/incubator-devlake/plugins/core"
+	"gorm.io/datatypes"
+	"time"
+)
+
+type createTapState struct{}
+
+type SingerTapState20221015 struct {
+	Id           string `gorm:"primaryKey;type:varchar(255)"`
+	ConnectionId uint64
+	Type         string
+	Value        datatypes.JSON
+	CreatedAt    time.Time
+	UpdatedAt    time.Time
+}
+
+func (SingerTapState20221015) TableName() string {
+	return "tap_state"
+}
+
+func (*createTapState) Up(basicRes core.BasicRes) errors.Error {
+	err := basicRes.GetDal().AutoMigrate(SingerTapState20221015{})
+	if err != nil {
+		return errors.Convert(err)

Review Comment:
   I don't think we need the `errors.Convert` anymore



##########
models/migrationscripts/20221015_create_singer_state.go:
##########
@@ -0,0 +1,56 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package migrationscripts
+
+import (
+	"github.com/apache/incubator-devlake/errors"
+	"github.com/apache/incubator-devlake/plugins/core"
+	"gorm.io/datatypes"
+	"time"
+)
+
+type createTapState struct{}
+
+type SingerTapState20221015 struct {
+	Id           string `gorm:"primaryKey;type:varchar(255)"`
+	ConnectionId uint64
+	Type         string
+	Value        datatypes.JSON
+	CreatedAt    time.Time
+	UpdatedAt    time.Time
+}
+
+func (SingerTapState20221015) TableName() string {
+	return "tap_state"

Review Comment:
   For framework table, it should be prefixed by `_devlake_`



##########
plugins/helper/batch_save_divider.go:
##########
@@ -35,11 +35,12 @@ type BatchSaveDivider struct {
 	db        dal.Dal
 	batches   map[reflect.Type]*BatchSave
 	batchSize int
-	table     string
-	params    string
+	rawTable  string

Review Comment:
   I think we should revert this file if we all agreed raw layer is neccessary



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org