Skip to content
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

Feat: add risingwave engine adapter support for sqlmesh. #3436

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

lin0303-siyuan
Copy link

Risingwave engine adapter is functioning well with simple model tests like create view, post statements...

COMMENT_CREATION_VIEW = CommentCreationView.COMMENT_COMMAND_ONLY
SUPPORTS_MATERIALIZED_VIEWS = True

SCHEMA_DIFFER = SchemaDiffer(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be copy+pasted directly from the Postgres adapter. Rather than duplicating it, can you extend it instead?

"""Begin a new session."""
self._set_flush()

def _fetch_native_df(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also looks like it was copy+pasted directly from the Postgres adapter...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, because risingwave is postgres-compatible, which means postgres engine adapter works for risingwave with few changes. Do you have an idea on how to support it without manually copying?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So instead of copy+pasting the PostgresEngineAdapter class definition:

class RisingwaveEngineAdapter(
    BasePostgresEngineAdapter,
    PandasNativeFetchDFSupportMixin,
    GetCurrentCatalogFromFunctionMixin,
):

Is there a reason you cant extend it instead?

class RisingwaveEngineAdapter(PostgresEngineAdapter):

@@ -89,6 +89,14 @@ gateways:
cluster: cluster1
state_connection:
type: duckdb
inttest_risingwave:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the integration tests to run on CircleCI without the port 5432 failed: server closed the connection unexpectedly error, you'll also need to add a branch for risingwave to .circleci/wait-for-db.sh to block until the DB server is available

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Erin, thanks for your help, I have updated and now there are some issues with the integration tests and I am trying to fix them.

@@ -1672,6 +1672,48 @@ def get_catalog(self) -> t.Optional[str]:
return self.catalog_name


class RisingwaveConnectionConfig(ConnectionConfig):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. If there is nothing different in the connection properties between RisingWaveConnectionConfig and the PostgresConnectionConfig, why not just extend PostgresConnectionConfig and override the internal properties like type_ and _engine_adapter etc instead of copy+paste?

Unnecessary copy+paste is considered a code smell and doesn't meet the standards of this codebase

@tobymao
Copy link
Contributor

tobymao commented Dec 11, 2024

@lin0303-siyuan do you have plans to finish this?

@lin0303-siyuan
Copy link
Author

@tobymao Hi Toby, I have some issues last two weeks and plan to resume this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants