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

schema/inspect: support inspect for non-database resource #1586

Merged
merged 8 commits into from
Apr 15, 2023

Conversation

giautm
Copy link
Member

@giautm giautm commented Apr 13, 2023

This PR updates the atlas schema inspect command to support other resources: sql-file, hcl-file, and Ent's schema. When you do inspect those resources, you need to provide a dev-DB for Atlas to replay changes on it.

With an unexpected side effect, to fix what we believe to be a bug with the inspect command. The --exclude flag when used with schema connection can only exclude sub-resources such as: table, column, index, ... and no longer exclude the current schema.

Those commands are invalid

atlas schema inspect -u "mysql://user:pass@localhost:3306/dbname" --exclude=dbname
atlas schema inspect -u "mysql://user:pass@localhost:3306/dbname" --exclude=dbname.*
atlas schema inspect -u "mysql://user:pass@localhost:3306/dbname" --exclude=dbname.table1

Need to update to this:

atlas schema inspect -u "mysql://user:pass@localhost:3306/dbname" --exclude=*
atlas schema inspect -u "mysql://user:pass@localhost:3306/dbname" --exclude=table1

For connection to realm, the exclude flag doesn't affect by this PR. So the bellow command still working fine.

atlas schema inspect -u "mysql://user:pass@localhost:3306" --exclude=dbname

Signed-off-by: Giau. Tran Minh <hello@giautm.dev>
Signed-off-by: Giau. Tran Minh <hello@giautm.dev>
Signed-off-by: Giau. Tran Minh <hello@giautm.dev>
Signed-off-by: Giau. Tran Minh <hello@giautm.dev>
Signed-off-by: Giau. Tran Minh <hello@giautm.dev>
@giautm giautm changed the title cmdapi: support stateLoaders on schema inspect schema/inspect: support inspect for non-database resource Apr 14, 2023
Signed-off-by: Giau. Tran Minh <hello@giautm.dev>
@giautm giautm marked this pull request as ready for review April 14, 2023 11:24
@giautm giautm requested review from a8m and masseelch April 14, 2023 11:24
@giautm
Copy link
Member Author

giautm commented Apr 14, 2023

I will wait for @a8m stamp.

Copy link
Member

@a8m a8m left a comment

Choose a reason for hiding this comment

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

Looks good, but see my only comment there.

Signed-off-by: Giau. Tran Minh <hello@giautm.dev>
Signed-off-by: Giau. Tran Minh <hello@giautm.dev>
@giautm giautm merged commit 02312ad into master Apr 15, 2023
@giautm giautm deleted the g/inspect-files-url branch April 15, 2023 02:17
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