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

Support risingwave schema inspect #2898

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

neverchanje
Copy link

@neverchanje neverchanje commented Jun 26, 2024

Hi, atlasgo devs,

I want to contribute the integration for RisingWave, a pgwire-compatible database primarily targeting streaming. We've heard from several users praising the usability of atlasgo, and we believe integrating both tools would streamline the user experience.

At first, I tried directly connecting RisingWave via the Postgres connector, but atlasgo threw serveral errors due to the lack of some SQL features at the RisingWave side. These features are currently unnecessary in RisingWave's context, so I had to tweak atlasgo to work properly with RisingWave.

A major modification is that I introduced a separate branch to check if atlas is connecting to RisingWave:

	c.risingwave, err = c.isRisingWaveConn()
	if err != nil {
		return nil, fmt.Errorf("postgres: failed checking if connected to RisingWave: %w", err)
	}
	if c.risingwave {
		return noLockDriver{
			&Driver{
				conn:        c,
				Differ:      &sqlx.Diff{DiffDriver: &risingwaveDiff{diff{c}}},
				Inspector:   &risingwaveInspect{inspect{c}},
				PlanApplier: &planApply{c},
			},
		}, nil
	}

If it is, all further execution will go to RisingWave-specific implementation.

Another tricky part is:

-	LEFT JOIN pg_depend AS t5 ON t5.classid = 'pg_catalog.pg_class'::regclass::oid AND t5.objid = t3.oid AND t5.deptype = 'e'
+	LEFT JOIN pg_depend AS t5 ON t5.classid::text = 'pg_catalog.pg_class' AND t5.objid = t3.oid AND t5.deptype = 'e'

I slightly adjusted the comparison, removing ::regclass::oid. I used text instead of oid for comparison. This is because RisingWave doesn't support regclass nor oid. I thin using text would achieve better compatibility with other PG-like databases. 😄 I hope this modification would not break anything.

@a8m
Copy link
Member

a8m commented Jun 26, 2024

Hey! Thanks for the contribution, @neverchanje.

Unfortunately, we cannot accept these changes and commit to support this new database. If the database is compatible with the PostgreSQL information schema, it should work with the current driver as is.

If you are working at RisingWave, you are welcome to send me a message on our Discord server and we can discuss this partnership.

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.

2 participants