Skip to content

Commit

Permalink
feat: add soql support query_type (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
afthabvp authored Apr 8, 2024
1 parent 38bf264 commit 4948b80
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 5 deletions.
2 changes: 1 addition & 1 deletion integrations/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ GIT
PATH
remote: .
specs:
multiwoven-integrations (0.1.53)
multiwoven-integrations (0.1.54)
activesupport
async-websocket
csv
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ module Types
SyncStatus = Types::String.enum("started", "running", "complete", "incomplete")
DestinationSyncMode = Types::String.enum("insert", "upsert")
ConnectorType = Types::String.enum("source", "destination")
ModelQueryType = Types::String.enum("raw_sql", "dbt")
ConnectorQueryType = Types::String.enum("raw_sql", "soql")
ModelQueryType = Types::String.enum("raw_sql", "dbt", "soql")
ConnectionStatusType = Types::String.enum("succeeded", "failed")
StreamType = Types::String.enum("static", "dynamic")
StreamAction = Types::String.enum("fetch", "create", "update", "delete")
Expand Down Expand Up @@ -69,6 +70,7 @@ class Connector < ProtocolModel
attribute :name, Types::String
attribute :type, ConnectorType
attribute :connection_specification, Types::Hash
attribute :query_type, ConnectorQueryType.optional.default("raw_sql")
end

class LogMessage < ProtocolModel
Expand Down
2 changes: 1 addition & 1 deletion integrations/lib/multiwoven/integrations/rollout.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module Multiwoven
module Integrations
VERSION = "0.1.53"
VERSION = "0.1.54"

ENABLED_SOURCES = %w[
Snowflake
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ module Integrations::Protocol
end

RSpec.describe Model do
describe ".from_json" do
context ".from_json" do
it "creates an instance from JSON" do
json_data = {
"name": "example_model",
Expand All @@ -324,10 +324,27 @@ module Integrations::Protocol
expect(model.primary_key).to eq("id")
end
end

context "query_type validations" do
it "has a query_type 'sql'" do
model = Model.new(name: "Test", query: "SELECT * FROM table", query_type: "raw_sql", primary_key: "id")
expect(ModelQueryType.values).to include(model.query_type)
end

it "has a query_type 'soql'" do
model = Model.new(name: "Test", query: "SELECT * FROM table", query_type: "soql", primary_key: "id")
expect(ModelQueryType.values).to include(model.query_type)
end

it "has a query_type 'dbt'" do
model = Model.new(name: "Test", query: "SELECT * FROM table", query_type: "dbt", primary_key: "id")
expect(ModelQueryType.values).to include(model.query_type)
end
end
end

RSpec.describe Connector do
describe ".from_json" do
context ".from_json" do
it "creates an instance from JSON" do
json_data = {
"name": "example_connector",
Expand All @@ -342,6 +359,23 @@ module Integrations::Protocol
expect(connector.connection_specification).to eq(key: "value")
end
end

context "connector_query_type validations" do
it "has a connector_query_type 'sql'" do
connector = Connector.new(name: "Test", type: "source", query_type: "soql", connection_specification: {})
expect(ModelQueryType.values).to include(connector.query_type)
end

it "has a connector_query_type 'soql'" do
connector = Connector.new(name: "Test", type: "destination", query_type: "soql", connection_specification: {})
expect(ModelQueryType.values).to include(connector.query_type)
end

it "has a query_type default raw_sql " do
connector = Connector.new(name: "Test", type: "destination", connection_specification: {})
expect(connector.query_type).to eq("raw_sql")
end
end
end

RSpec.describe Multiwoven::Integrations::Protocol::ControlMessage do
Expand Down

0 comments on commit 4948b80

Please sign in to comment.