Skip to content

Commit

Permalink
Added S3 uploader
Browse files Browse the repository at this point in the history
  • Loading branch information
shubham19may committed Dec 22, 2024
1 parent 8ac156b commit e9b2264
Show file tree
Hide file tree
Showing 6 changed files with 494 additions and 0 deletions.
1 change: 1 addition & 0 deletions connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/datazip-inc/olake/logger"
protocol "github.com/datazip-inc/olake/protocol"
_ "github.com/datazip-inc/olake/writers/local"
_ "github.com/datazip-inc/olake/writers/s3"
"github.com/piyushsingariya/relec/safego"
)

Expand Down
221 changes: 221 additions & 0 deletions drivers/mongodb/examples/catalog.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
{
"streams": [
{
"stream": {
"name": "tweets",
"namespace": "twitter_data",
"type_schema": {
"properties": {
"_id": {
"type": [
"string"
]
},
"contributors": {
"type": [
"null"
]
},
"coordinates": {
"type": [
"null",
"object"
]
},
"created_at": {
"type": [
"string"
]
},
"delete": {
"type": [
"object"
]
},
"display_text_range": {
"type": [
"array"
]
},
"entities": {
"type": [
"object"
]
},
"extended_entities": {
"type": [
"object"
]
},
"extended_tweet": {
"type": [
"object"
]
},
"favorite_count": {
"type": [
"integer"
]
},
"favorited": {
"type": [
"boolean"
]
},
"filter_level": {
"type": [
"string"
]
},
"geo": {
"type": [
"null",
"object"
]
},
"id": {
"type": [
"integer"
]
},
"id_str": {
"type": [
"string"
]
},
"in_reply_to_screen_name": {
"type": [
"string",
"null"
]
},
"in_reply_to_status_id": {
"type": [
"null",
"integer"
]
},
"in_reply_to_status_id_str": {
"type": [
"null",
"string"
]
},
"in_reply_to_user_id": {
"type": [
"null",
"integer"
]
},
"in_reply_to_user_id_str": {
"type": [
"null",
"string"
]
},
"is_quote_status": {
"type": [
"boolean"
]
},
"lang": {
"type": [
"string"
]
},
"place": {
"type": [
"null",
"object"
]
},
"possibly_sensitive": {
"type": [
"boolean"
]
},
"quote_count": {
"type": [
"integer"
]
},
"quoted_status": {
"type": [
"object"
]
},
"quoted_status_id": {
"type": [
"integer"
]
},
"quoted_status_id_str": {
"type": [
"string"
]
},
"reply_count": {
"type": [
"integer"
]
},
"retweet_count": {
"type": [
"integer"
]
},
"retweeted": {
"type": [
"boolean"
]
},
"retweeted_status": {
"type": [
"object"
]
},
"source": {
"type": [
"string"
]
},
"text": {
"type": [
"string"
]
},
"timestamp_ms": {
"type": [
"string"
]
},
"truncated": {
"type": [
"boolean"
]
},
"user": {
"type": [
"object"
]
},
"withheld_in_countries": {
"type": [
"array"
]
}
}
},
"supported_sync_modes": [
"full_refresh",
"cdc"
],
"source_defined_primary_key": [
"_id"
],
"available_cursor_fields": []
},
"sync_mode": "cdc"
}
]
}
7 changes: 7 additions & 0 deletions drivers/mongodb/examples/writer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type" : "S3",
"writer": {
"bucket":"test-snowfl",
"region":"ap-south-1"
}
}
2 changes: 2 additions & 0 deletions drivers/mongodb/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ require (

require (
github.com/apache/thrift v0.16.0 // indirect
github.com/aws/aws-sdk-go v1.43.31 // indirect
github.com/felixge/fgprof v0.9.5 // indirect
github.com/fraugster/parquet-go v0.12.0 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
Expand All @@ -17,6 +18,7 @@ require (
github.com/gorilla/mux v1.8.1 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/montanaflynn/stats v0.7.1 // indirect
Expand Down
12 changes: 12 additions & 0 deletions writers/s3/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package s3

import "github.com/piyushsingariya/relec"

type Config struct {
Bucket string `json:"bucket" validate:"required"`
Region string `json:"region" validate:"required"`
}

func (c *Config) Validate() error {
return relec.Validate(c)
}
Loading

0 comments on commit e9b2264

Please sign in to comment.