Skip to content

This is a Python script that automatically converts SQLite database files into Dart files compatible with Flutter's Drift ORM. It simplifies the process of integrating SQLite databases into Flutter applications by generating complete database model code.

License

Notifications You must be signed in to change notification settings

senlinjun/sqlite2drift

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SQLite to Drift ORM Conversion Tool

Python Drift

简体中文 English

Project Overview

This is a Python script that automatically converts SQLite database files into Dart files compatible with Flutter's Drift ORM. It simplifies the process of integrating SQLite databases into Flutter applications by generating complete database model code.

Key Features

  • 🔄 Automatically converts SQLite table structures to Drift Table classes
  • 🧩 Supports common data types (INTEGER, TEXT, BLOB, REAL, NUMERIC)
  • 🔑 Handles primary key constraints (single, composite, auto-increment)
  • ⚙️ Converts field constraints (not null, unique, default values)
  • ✨ Automatically generates database connection configuration code
  • 🧹 Automatically formats generated Dart code

Quick Start

# Basic usage (output file defaults to input filename + .dart)
python sqlite2drift.py my_database.sqlite

# Specify output file
python sqlite2drift.py my_database.sqlite -o lib/database/app_db.dart

# Use Flutter plugin
python sqlite2drift.py my_database.sqlite -f

Future Plans

We plan to expand this tool to support more database types:

  • ✅ Currently supported: SQLite
  • 📅 Planned: PostgreSQL

Contributions and feature suggestions are welcome!

About

This is a Python script that automatically converts SQLite database files into Dart files compatible with Flutter's Drift ORM. It simplifies the process of integrating SQLite databases into Flutter applications by generating complete database model code.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages