Reverse engineering of the .sdf (SQL Server Compact Edition) binary file format.
Analysis of the format's internal structure based on decompiled SQL CE components. The goal is to provide a cross-platform, runtime-independent implementation for reading .sdf files.
Intended solely for interoperability with existing
.sdffiles. Does not contain any original product source code.
Browser version (WebAssembly, runs locally - the file never leaves your tab): boykopovar.github.io/sqlce
core/— C++ parser implementationbindings/— Bindings for the C++ library to other languagespython/sqlce/— Python APIresearch/— Experimental scripts
pip install sqlcefrom sqlce import SdfDatabase
db = SdfDatabase("example.sdf", password="secret123")
for table_name in db.list_tables():
print(table_name, db.table_schema(table_name))
for row in db.read_table(table_name):
print(row)The current implementation supports reading the list of tables, table schemas, and table contents (including password-protected databases). It is implemented in C++.
Reading encrypted .sdf version 3.5 files is not currently supported (unencrypted files are supported).
pytestThe tests use a locally installed SQL CE engine (via ODBC) to generate .sdf files containing predefined data and verify that the parser produces identical results. Therefore, the test suite can only be run on Windows with SQL Server Compact 4.0 installed. Test files are created in tests/sdf/ and are automatically removed before and after each test run.
The documentation is currently concise but includes usage examples and tests.
Code Style Conventions (Pull requests are welcome.)