sqlce bindings for libsdf (pybind11). Parses .sdf files (SQL Server Compact).
pip install sqlcefrom sqlce import SdfDatabase
db = SdfDatabase("file.sdf")
# or with a password
db = SdfDatabase("file.sdf", "password")
for name in db.list_tables():
print(name)
for col in db.table_schema("MyTable"):
print(col.ordinal, col.name, col.type_name, col.declared_size, col.precision, col.scale)
rows = db.read_table("MyTable") # list of dicts {column name: value}__init__(path)/__init__(path, password)- open a filelist_tables() -> List[str]table_schema(name) -> List[ColumnSchema]read_table(name) -> List[Row]
Properties: ordinal, name, type_name, declared_size, precision, scale (the last two are Optional[int]).
Column values are regular Python objects: None, int, float, bool, str, bytes, datetime.datetime, decimal.Decimal, uuid.UUID.
Row = Dict[str, ColumnValue] - simply a dictionary.
UnsupportedEncryptionModeError(ValueError)- unsupported .sdf encryption modeInvalidPasswordError(ValueError)- incorrect password
A working usage example can be found in main.py in the repository root.