db_diagram
write_markdown
write_markdown(
metadata_source: (
sqlalchemy.MetaData
| collections.abc.Iterable[
sqlalchemy.sql.schema.Table
]
| sqlalchemy.sql.schema.Table
| str
| sqlalchemy.URL
| sqlalchemy.Engine
| sqlalchemy.Connection
),
path: pathlib.Path | str,
header_level: int = 2,
title: str | None = None,
depth: int = 1,
image_directory: pathlib.Path | str | None = None,
image_format: str = "svg",
include: str | tuple[str, ...] = (),
exclude: str | tuple[str, ...] = (),
) -> None
Write a markdown document, containing mermaid diagrams, for the specified metadata or tables, to the specified path.
Parameters:
-
metadata_source
(sqlalchemy.MetaData | collections.abc.Iterable[sqlalchemy.sql.schema.Table] | sqlalchemy.sql.schema.Table | str | sqlalchemy.URL | sqlalchemy.Engine | sqlalchemy.Connection
) –SQLAlchemy metadata, tables, or a connection string
-
path
(pathlib.Path | str
) –The path to which to write the markdown document.
-
title
(str | None
, default:None
) –The title of the markdown document. If not specified, the file name (sans extension) will be used as the title.
-
depth
(int
, default:1
) –The depth of the relationship graph to include in each diagram
-
include
(str | tuple[str, ...]
, default:()
) –Include only tables and views matching the specified pattern(s)
-
exclude
(str | tuple[str, ...]
, default:()
) –Exclude tables and views matching the specified pattern(s)
Source code in src/db_diagram/_mermaid.py
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 |
|
write_mermaid_images
write_mermaid_images(
metadata_source: (
sqlalchemy.MetaData
| collections.abc.Iterable[
sqlalchemy.sql.schema.Table
]
| sqlalchemy.sql.schema.Table
| str
| sqlalchemy.URL
| sqlalchemy.Engine
| sqlalchemy.Connection
),
directory: str | pathlib.Path,
*,
image_format: str = "svg",
depth: int = 1,
config_file: str | pathlib.Path | None = None,
background_color: str | None = "transparent",
include: str | tuple[str, ...] = (),
exclude: str | tuple[str, ...] = (),
theme: str | None = None
) -> None
Write images for the specified class(es) in the specified directory.
Parameters:
-
metadata_source
(sqlalchemy.MetaData | collections.abc.Iterable[sqlalchemy.sql.schema.Table] | sqlalchemy.sql.schema.Table | str | sqlalchemy.URL | sqlalchemy.Engine | sqlalchemy.Connection
) –A SQLAlchemy connection URL, engine, connection, or metadata from which to derive schema information
-
directory
(str | pathlib.Path
) –The directory under which to write the images.
-
image_format
(str
, default:'svg'
) –svg | png
-
config_file
(str | pathlib.Path | None
, default:None
) –A path to a mermaid config file
-
background_color
(str | None
, default:'transparent'
) –A CSS background color
-
depth
(int
, default:1
) –The depth of the relationship graph to include in each diagram
-
include
(str | tuple[str, ...]
, default:()
) –Include only tables and views matching the specified pattern(s)
-
exclude
(str | tuple[str, ...]
, default:()
) –Exclude tables and views matching the specified pattern(s)
-
theme
(str | None
, default:None
) –default | neutral | dark | forest | base
Source code in src/db_diagram/_mermaid.py
572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 |
|
write_mermaid_markdown
write_mermaid_markdown(
metadata_source: (
sqlalchemy.MetaData
| collections.abc.Iterable[
sqlalchemy.sql.schema.Table
]
| sqlalchemy.sql.schema.Table
| str
| sqlalchemy.URL
| sqlalchemy.Engine
| sqlalchemy.Connection
),
directory: pathlib.Path | str = "database",
depth: int = 1,
include: str | tuple[str, ...] = (),
exclude: str | tuple[str, ...] = (),
) -> None
Write mermaid markdown documents for the specified base class in the specified directory.
Parameters:
-
metadata_source
(sqlalchemy.MetaData | collections.abc.Iterable[sqlalchemy.sql.schema.Table] | sqlalchemy.sql.schema.Table | str | sqlalchemy.URL | sqlalchemy.Engine | sqlalchemy.Connection
) –A SQLAlchemy database connection, connection string, metadata instance, or tables
-
directory
(pathlib.Path | str
, default:'database'
) –The directory under which to which to write the mermaid markdown documents.
-
depth
(int
, default:1
) –The depth of the relationship graph to include in each diagram
-
include
(str | tuple[str, ...]
, default:()
) –Include only tables and views matching the specified pattern(s)
-
exclude
(str | tuple[str, ...]
, default:()
) –Exclude tables and views matching the specified pattern(s)
Source code in src/db_diagram/_mermaid.py
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 |
|