Skip to main content

Adding schemas to data stores

EventCatalog is technically agnostic, meaning it can support any file format or schema format.

When you document your data stores, you may want to also include schemas, queries, or other files that are relevant to your data store.

You can attach this information in two ways:

Using codeblocks to render your schema​

You can use codeblocks to render your schema in your markdown files.

Here is an example of a SQL codeblock:

```sql
CREATE TABLE users (
id INT PRIMARY KEY,
name VARCHAR(255),
email VARCHAR(255)
);
```_

You can learn more about codeblocks and configuring them in the codeblocks documentation.

Using the <Schema/> component to render your schema from a file​

If you prefer to have your schemas, or information about your data store in a file, you can use the <Schema/> component to render your schema from a file.

First you need to add your file in the directory of your data store

Example

  • /containers/OrdersDatabase/schema.sql
  • /containers/OrdersDatabase/queries.sql
<!-- Render the file into your page -->
<Schema file="schema.sql" lang="sql" title="Users Table" />

<!-- Render the schemas separately in an AccordionGroup -->
<AccordionGroup>
<Accordion title="Users Table">
<!-- Load the schema from the file -->
<Schema file="schema.sql" lang="sql" title="Users Table" />
</Accordion>
<Accordion title="Common Queries">
<!-- Load the queries from the file -->
<Schema file="queries.sql" lang="sql" title="Common Queries" />
</Accordion>
</AccordionGroup>

You can an example of this in the EventCatalog Demo.

Versioning information

Remember everything in EventCatalog can be versioned. So when your data store changes you can version your data stores, and write changes logs to help your teams understand what has changed.