TL;DR
Create a visualization of your Ent schema with one command:
atlas schema inspect \
-u ent://ent/schema \
--dev-url "sqlite://demo?mode=memory&_fk=1" \
--visualize
Hi Everyone!
A few months ago, we shared entviz, a cool tool that enables you to visualize your Ent schemas. Due to its success and popularity, we decided to integrate it directly into Atlas, the migration engine that Ent uses.
Since the release of v0.13.0 of Atlas, you can now visualize your Ent schemas directly from Atlas without needing to install an additional tool.
Private vs. Public Visualizations
Previously, you could only share a visualization of your schema to the Atlas Public Playground. While this is convenient for sharing your schema with others, it is not acceptable for many teams who maintain schemas that themselves are sensitive and cannot be shared publicly.
With this new release, you can easily publish your schema directly to your private workspace on Atlas Cloud. This means that only you and your team can access the visualization of your schema.
Visualizing your Ent Schema with Atlas
To visualize your Ent schema with Atlas, first install its latest version:
curl -sSfL https://atlasgo.io/install.sh | sh
For other installation options, see the Atlas installation docs.
Next, run the following command to generate a visualization of your Ent schema:
atlas schema inspect \
-u ent://ent/schema \
--dev-url "sqlite://demo?mode=memory&_fk=1" \
--visualize
Let's break this command down:
atlas schema inspect
- this command can be used to inspect schemas from a variety of sources and outputs them in various formats. In this case, we are using it to inspect an Ent schema.-u ent://ent/schema
- this is the URL to the Ent schema we want to inspect. In this case, we are using theent://
schema loader to point to a local Ent schema in the./ent/schema
directory.--dev-url "sqlite://demo?mode=memory&_fk=1"
- Atlas relies on having an empty database called the Dev Database to normalize schemas and make various calculations. In this case, we are using an in memory SQLite database; but, if you are using a different driver, you can usedocker://mysql/8/dev
(for MySQL) ordocker://postgres/15/?search_path=public
(for PostgreSQL).
Once you run this command, you should see the following output:
Use the arrow keys to navigate: ↓ ↑ → ←
? Where would you like to share your schema visualization?:
▸ Publicly (gh.atlasgo.cloud)
Your personal workspace (requires 'atlas login')
If you want to share your schema publicly, you can select the first option. If you want to share it privately, you can select the second option and then run atlas login
to log in to your (free) Atlas account.
Wrapping up
In this post, we showed how you can easily visualize your Ent schema with Atlas. We hope you find this feature useful and we look forward to hearing your feedback!
- Subscribe to our Newsletter
- Follow us on Twitter
- Join us on #ent on the Gophers Slack
- Join us on the Ent Discord Server