Skip to main content

universal_database_inspector

MySQL 데이터베이스의 스키마를 자동으로 분석하고, AI를 활용하여 컬럼 라벨링과 테이블 설명을 생성하는 Python 패키지입니다.

Features

  • 스키마 추출 — 데이터베이스의 전체 테이블·컬럼 구조를 JSON으로 저장
  • AI 컬럼 라벨링 — OpenAI 모델을 활용하여 각 컬럼의 한국어 라벨을 자동 생성
  • AI 테이블 설명 — 테이블의 목적과 용도를 한국어로 요약
  • 테이블 통계 — 행 수, 컬럼 수, 날짜 범위 자동 수집
  • Table 객체 — 테이블별 구조·라벨·설명·데이터를 하나의 인터페이스로 접근

Installation

pip install universal-database-inspector

Setup

.env.example을 참고하여 .env 파일을 생성합니다.

# MySQL Database Connection
DB_HOST=your_host
DB_PORT=3306
DB_USER=your_user
DB_PASSWORD=your_password
DB_NAME=your_database

# OpenAI API Key
OPENAI_API_KEY=your_openai_api_key

Quick Start

from universal_database_inspector import init_structure, inspect_all, describe_all_tables, Table

1. 출력 폴더 초기화

init_structure()
database_structure/
├── labels/
└── description/

2. 데이터베이스 구조 추출

structure = inspect_all()
list(structure.keys())
# ['bond', 'currency', 'daily_price', 'index', 'index_membership', 'stock_info']

database_structure/structure.json에 전체 테이블-컬럼 매핑이 저장됩니다.

3. 테이블 설명 생성

describe_all_tables()

각 테이블에 대해 AI 라벨링과 설명 파일을 일괄 생성합니다.

[1/6] describing: bond
[2/6] describing: currency
...
done: 6 created, 0 skipped (total 6)

4. Table 객체로 접근

table = Table('bond')

table.columns       # ['code', 'date', 'open', 'high', 'low', 'close']
table.labels        # {'code': '채권 코드', 'date': '거래일자', 'open': '시가', ...}
table.description   # {'description': '...', 'first_date': '1962-01-02', 'last_date': '2026-02-20', ...}
table.df            # 원본 데이터 DataFrame
table.labeled       # 한국어 라벨이 적용된 DataFrame

Output Structure

database_structure/
├── structure.json              # 전체 테이블-컬럼 구조
├── labels/
│   ├── bond.json               # {"code": "채권 코드", "date": "거래일자", ...}
│   ├── currency.json
│   └── ...
└── description/
    ├── bond.json               # {"description": "...", "row_count": 85376, ...}
    ├── currency.json
    └── ...

CLI

python -m universal_database_inspector
python -m universal_database_inspector --overwrite

Dependencies

  • mysql-connector-python — MySQL 연결
  • sqlalchemy — ORM 엔진
  • pandas — 데이터 처리
  • python-dotenv — 환경변수 로딩
  • openai — OpenAI API 호출

Metadata

Release files for universal-database-inspector 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for universal-database-inspector 0.1.2
File Size Uploaded
universal_database_inspector-0.1.2.tar.gz 12.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for universal-database-inspector 0.1.2
File Interpreter ABI Platform
universal_database_inspector-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 29.7 kB

Release files / universal_database_inspector-0.1.2.tar.gz

Download URL universal_database_inspector-0.1.2.tar.gz
Size 12.9 kB
Tags Source
SHA-256 checksum
How to use checksums
5f251bd3d60b05663bda27de83052a82a0c7f1a0d4ae076263db0cf60d6ad91f
BLAKE2b-256 checksum
How to use checksums
2b420c2f0e5eca1695e68082463b05f5d541a3679ef3dbf650222fd749fe4bd3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release files / universal_database_inspector-0.1.2-py3-none-any.whl

Download URL universal_database_inspector-0.1.2-py3-none-any.whl
Size 16.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
09b8f25fe1a8b3ce65f17cdeac42f6627e6dd1236fcecccd5d82ea9587ceb2ef
BLAKE2b-256 checksum
How to use checksums
7b811474080890fd5c552264e3da8964a2ff11438fec3b43b06b40b78590c0a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page