Skip to content

Latest commit

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

BacpacToSqlite

A .NET 10 command-line tool that converts Microsoft SQL Server .bacpac exports to SQLite databases.

Installation

Requires .NET 10 SDK. No build step needed — the wrapper script handles it.

Usage

./bacpac2sqlite --bacpac <path> --sqlite <path> [options]

Options

OptionDefaultDescription
--bacpac (required)Path to .bacpac file
--sqlite (required)Path to SQLite output (created if missing)
--tablesallTable name globs to include
--excludenoneTable name globs to exclude
--batchSize5000Rows per transaction batch
--pragmaFastonApply fast PRAGMA settings
--foreignKeysOffonDisable foreign keys during import
--truncateoffTruncate existing tables before import
--validateCountsonValidate row counts after import
--bcpProfileautoBCP profile: auto, native, unicode-native
--inspectoffPrint archive inventory and exit
--verboseoffVerbose output

Examples

Convert a BACPAC to SQLite:

./bacpac2sqlite --bacpac database.bacpac --sqlite output.db

Convert only specific tables:

./bacpac2sqlite --bacpac database.bacpac --sqlite output.db \
--tables "dbo.Orders""dbo.Customers"

Exclude tables by pattern:

./bacpac2sqlite --bacpac database.bacpac --sqlite output.db \
--exclude "*Log*""*Audit*"

Inspect BACPAC contents without converting:

./bacpac2sqlite --bacpac database.bacpac --inspect --verbose

Exit codes

CodeMeaning
0Success
2Invalid arguments or missing input file
3BACPAC parsing error
4One or more tables failed (partial success)

Supported SQL Server types

Integers (tinyint, smallint, int, bigint), bit, float, real, uniqueidentifier, decimal/numeric, money/smallmoney, date, time, datetime, datetime2, datetimeoffset, smalldatetime, char/varchar/nvarchar/nchar/text/ntext, binary/varbinary/image, xml, sql_variant, hierarchyid, geometry, geography, timestamp/rowversion.

Computed columns are automatically skipped (they are not stored in BACPAC BCP data).

Running tests

dotnet test BacpacToSqlite/

Project structure

BacpacToSqlite/
src/
BacpacToSqlite.Cli/ Console application (System.CommandLine)
BacpacToSqlite.Core/ Core library
BcpNative/ BCP binary format parser
Planning/ Table/column metadata
tests/
BacpacToSqlite.Tests/ xUnit tests

About

Convert SQL Server .bacpac exports to SQLite databases

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages