Skip to content

Commit

Permalink
MySQL peer (#1637)
Browse files Browse the repository at this point in the history
Currently testing with [mariadb](https://hub.docker.com/_/mariadb)
```
CREATE PEER my FROM MYSQL WITH (
  host = 'mysql',
  port = '3306',
  user = 'root',
  password = 'example',
  database = 'main',
  compression = 1,
  disable_tls = true
);
```

The scope of this PR is only peer creation & nexus proxy. No mirror support

Co-authored-by: Kaushik Iska <[email protected]>
  • Loading branch information
serprex and iskakaushik authored May 1, 2024
1 parent f7c7ac2 commit e301f78
Show file tree
Hide file tree
Showing 40 changed files with 1,651 additions and 721 deletions.
7 changes: 5 additions & 2 deletions flow/connectors/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
connelasticsearch "github.com/PeerDB-io/peer-flow/connectors/connelasticsearch"
conneventhub "github.com/PeerDB-io/peer-flow/connectors/eventhub"
connkafka "github.com/PeerDB-io/peer-flow/connectors/kafka"
connmysql "github.com/PeerDB-io/peer-flow/connectors/mysql"
connpostgres "github.com/PeerDB-io/peer-flow/connectors/postgres"
connpubsub "github.com/PeerDB-io/peer-flow/connectors/pubsub"
conns3 "github.com/PeerDB-io/peer-flow/connectors/s3"
Expand Down Expand Up @@ -224,14 +225,14 @@ func GetConnector(ctx context.Context, config *protos.Peer) (Connector, error) {
return connbigquery.NewBigQueryConnector(ctx, inner.BigqueryConfig)
case *protos.Peer_SnowflakeConfig:
return connsnowflake.NewSnowflakeConnector(ctx, inner.SnowflakeConfig)
case *protos.Peer_EventhubConfig:
return nil, errors.New("use eventhub group config instead")
case *protos.Peer_EventhubGroupConfig:
return conneventhub.NewEventHubConnector(ctx, inner.EventhubGroupConfig)
case *protos.Peer_S3Config:
return conns3.NewS3Connector(ctx, inner.S3Config)
case *protos.Peer_SqlserverConfig:
return connsqlserver.NewSQLServerConnector(ctx, inner.SqlserverConfig)
case *protos.Peer_MysqlConfig:
return connmysql.MySqlConnector{}, nil
case *protos.Peer_ClickhouseConfig:
return connclickhouse.NewClickhouseConnector(ctx, inner.ClickhouseConfig)
case *protos.Peer_KafkaConfig:
Expand Down Expand Up @@ -341,4 +342,6 @@ var (
_ ValidationConnector = &connclickhouse.ClickhouseConnector{}
_ ValidationConnector = &connbigquery.BigQueryConnector{}
_ ValidationConnector = &conns3.S3Connector{}

_ Connector = &connmysql.MySqlConnector{}
)
15 changes: 15 additions & 0 deletions flow/connectors/mysql/mysql.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// stub to bypass validation

package mysql

import "context"

type MySqlConnector struct{}

func (MySqlConnector) Close() error {
return nil
}

func (MySqlConnector) ConnectionActive(context.Context) error {
return nil
}
Loading

0 comments on commit e301f78

Please sign in to comment.