Inspect database schema, tables and columns and returns a metadata object
Project description
dbmeta v0.0.10
Database metadata extractor
Generate a Metadata object containing information about the database.
Install
pip install dbmeta
Use
import dbmeta
db_type = 'postgres'
db_url = 'postgres://postgres:postgres@localhost:5432'
metadata = dbmeta.gen_metadata(db_type, db_url)
Excluding schema or tables
Postgres system tables and schema are already excluded from the introspection.
To exclude other tables or schema use the exclude
class
from dbmeta import exclude
exclude.schema = ["hdb_catalog"]
exclude.tables = ["migrations"]
...
Classes
Metadata
class Metadata:
schema: List[Schema]
tables: List[Table]
columns: List[Column]
Schema
class Schema(DatabaseItem):
catalog_name: str
schema_name: str
schema_owner: str
tables: List[Table]
Table
class Table(DatabaseItem):
table_catalog: str
table_schema: str
table_name: str
table_type: str
columns: List[Column]
Column
class Column(DatabaseItem):
udt_name: str
table_catalog: str
table_schema: str
table_name: str
column_name: str
ordinal_position: int
column_default: str | None
is_nullable: Literal["YES"] | Literal["NO"]
data_type: str
character_maximum_length: int | None
is_updatable: bool
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dbmeta-0.0.10.tar.gz
(7.3 kB
view hashes)
Built Distribution
Close
Hashes for dbmeta-0.0.10-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d9257babaa1cd131ec44e681d942256e5d7dff81661e90a543733164d7bc274 |
|
MD5 | 18d6f652a7b05843d0018fa5e4a14720 |
|
BLAKE2b-256 | 0863fdd294ca9b8c5e3e32074bce3b2368d6bdb01d4b30d20e50d2edf78d56ce |