-
Notifications
You must be signed in to change notification settings - Fork 30
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
External service #1074
External service #1074
Conversation
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.
Great start! Could you also integrate ExternalService
into the src/db/test.rs
?
crates/pipeline-types/src/config.rs
Outdated
|
||
/// An external service's configuration. | ||
#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize, ToSchema)] | ||
pub enum ExternalServiceConfig { |
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.
If the type is already called ExternalService
, you don't need to also repeat the prefix in the inner *Config types.
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.
Inlined them into the Service enumeration OpenAPI Python did not like that, instead using explicit types MysqlConfig
and PostgresConfig
CREATE TABLE IF NOT EXISTS external_service ( | ||
id uuid PRIMARY KEY, -- Unique identifier (used primarily for foreign key relations) | ||
tenant_id uuid NOT NULL, -- Tenant the external service belongs to | ||
name varchar NOT NULL, -- Immutable unique name given by the tenant (e.g., mysql-example) used to refer to it in the API |
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 it already immutable in our API?
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, the PATCH /external_services/id
endpoint only allows updating description and config.
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.
We could also enforce it in the database with a trigger potentially (?)
|
I'd be okay changing it to |
Changing name to |
3fdb010
to
c01aa1e
Compare
I've rebased with main, incorporated feedback (see comments) and implemented the test database.
After this PR it might be also time to make |
It's more important to start with Kafka (let's start from all the services we use for connectors). So MySQL and Kafka would be the two important ones to start with. I don't think we need Postgres yet.
It's probably better to add external tests like python API tests after you integrate with connectors. As such, there's no external workflow we can support with this PR that depends on services being configured correctly.
The proptests should do.
Let's get the connector integration working first. |
if modified_rows == 0 { | ||
Err(DBError::UnknownService { service_id }) | ||
} else { | ||
assert_eq!(modified_rows, 1); |
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.
Log this as an error. Don't assert outside tests.
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.
Changed to:
if modified_rows != 1 {
error!("More than one row ({modified_rows}) was modified when updating service {service_id}");
}
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.
Why not return an error in this case? This looks like it should not happen.
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.
Changed to:
if modified_rows > 0 {
Ok(())
} else {
Err(DBError::UnknownService { service_id })
}
9e74c9b
to
01067a1
Compare
Rebased with main, incorporated feedback (removed assert and replaced Postgres service with Kafka service), added basic service integration test in integration_test.rs |
|
||
/// A service's configuration. | ||
#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize, ToSchema)] | ||
#[serde(rename_all = "snake_case")] |
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.
Why is the snake_case required?
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.
Added:
// snake_case such that the enumeration variants are not capitalized in (de-)serialization
462c86f
to
c92be4a
Compare
Adds the Service type with basic functionality to the pipeline-manager. This encompasses: - Database table: service - Basic database operations (list, create, get, update, delete) - API endpoints - Corresponding generated Python API - Database proptests - API integration test Signed-off-by: Simon Kassing <simon.kassing@feldera.com>
c92be4a
to
ca23685
Compare
External service concept is added. In order to have small PRs rather than large, this is the first with basic functionality for external services.
This PR encompasses:
service
Is this a user-visible change (yes/no): yes