# Import: DBML

> Create a data contract from a DBML file, with optional schema/table filters.

#  Import: DBML

Creates a data contract from a [DBML](https://dbml.dbdiagram.io/) file. You can filter by schema and table name.

{/* AUTOGENERATED EXAMPLE: do not edit by hand; regenerate with the update script. */}

Given this [`orders.dbml`](https://github.com/datacontract/datacontract-cli/blob/main/examples/imports/dbml/orders.dbml):

```text
Table orders {
  order_id varchar [pk, note: 'Unique identifier of the order.']
  order_timestamp timestamp [not null]
  customer_id varchar [not null]
  order_total bigint [not null]
  status varchar [not null]
}
```

Run:

```bash
datacontract import dbml --source orders.dbml
```

to produce the data contract:

```yaml
version: 1.0.0
kind: DataContract
apiVersion: v3.1.0
id: my-data-contract
name: My Data Contract
status: draft
schema:
- name: orders
  physicalType: table
  customProperties:
  - property: namespace
    value: public
  logicalType: object
  physicalName: orders
  properties:
  - name: order_id
    physicalType: varchar
    description: Unique identifier of the order.
    primaryKey: true
    primaryKeyPosition: 1
    logicalType: string
  - name: order_timestamp
    physicalType: timestamp
    logicalType: timestamp
    required: true
  - name: customer_id
    physicalType: varchar
    logicalType: string
    required: true
  - name: order_total
    physicalType: bigint
    logicalType: integer
    required: true
  - name: status
# …
```

{/* END AUTOGENERATED EXAMPLE */}

All options: **[`datacontract import dbml`](../commands/import/dbml.md)**.
