> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.emtelligent.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.emtelligent.com/_mcp/server.

# db.schemas.util

Shared utilities for defining schemas.

## Module Contents

### Functions

| Name                                                                               | Description                                                                                                                                                                                                                                                   |
| ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`create_metadata`](#emtelliprodbschemasutilcreate_metadata)                       | Create a new MetaData instance that can be used with SQLAlchemy Base class. Unless otherwise specified, this will use [`CONSTRAINT_CONVENTION`](/nlp/python/reference/db-schemas-util#emtelliprodbschemasutilconstraint_convention) as the naming convention. |
| [`model_lookup_by_table_name`](#emtelliprodbschemasutilmodel_lookup_by_table_name) | Given a declarative base class, return the model class with the given table name, or raise LookupError.                                                                                                                                                       |

### Data

`CONSTRAINT_CONVENTION`

### API

#### `emtellipro.db.schemas.util.CONSTRAINT_CONVENTION`

```python
emtellipro.db.schemas.util.CONSTRAINT_CONVENTION
```

A naming convention that's used

#### `emtellipro.db.schemas.util.create_metadata`

```python
emtellipro.db.schemas.util.create_metadata(
    naming_convention = None, **kwargs
)
```

Create a new MetaData instance that can be used with SQLAlchemy Base class.
Unless otherwise specified, this will use `CONSTRAINT_CONVENTION`
as the naming convention.

#### `emtellipro.db.schemas.util.model_lookup_by_table_name`

```python
emtellipro.db.schemas.util.model_lookup_by_table_name(
    cls, table_name
)
```

Given a declarative base class, return the model class with the given table
name, or raise LookupError.