Skip to content

A Python script to convert .DBF files into SQLite databases, supporting batch processing and data preservation.

License

Notifications You must be signed in to change notification settings

DevaanshPathak/DBFtoSQLite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

DBF to SQLite Converter

This script converts .DBF files into SQLite databases, preserving table structure and data. It supports batch processing of all .DBF files in a folder, generating corresponding .db files in the specified output directory.


Update Required Paths

Before running the script, update the following variables with the appropriate paths:

  • input_folder: The folder where your .DBF files are located.
  • output_folder: The folder where you want the generated SQLite .db files to be saved.

Example:

Replace the placeholders with your desired paths:

input_folder = r'C:\path\to\your\dbf\files'
output_folder = r'C:\path\to\your\output\folder'

Features

  • Converts .DBF files into SQLite-compatible databases.
  • Automatically creates SQLite .db files for each .DBF file in the input folder.
  • Handles date fields by converting them into YYYY-MM-DD format.

Requirements

  • Python: Version 3.12
  • DBFread: Version 2.0.7

Installation

  1. Install Python 3.12 from the official Python website: https://www.python.org/downloads/.
  2. Install the required library:
    pip install dbfread

Usage

  1. Update the input_folder and output_folder variables with your paths.
  2. Run the script:
    python dbf_to_sqlite.py
  3. SQLite .db files will be created in the specified output folder.

Notes

  • All fields in the SQLite database are stored as TEXT for simplicity. Modify the script to customize field types if needed.
  • Ensure the input_folder contains valid .DBF files and the output_folder is writable.

Example Workflow

  1. Place .DBF files in a folder, e.g., C:\Data\DBF_Files.
  2. Set input_folder to C:\Data\DBF_Files.
  3. Set output_folder to C:\Data\SQLite_Output.
  4. Run the script to generate .db files in C:\Data\SQLite_Output.

Contributing

Contributions are welcome! Fork the repository and submit pull requests for enhancements or bug fixes.


License

This project is licensed under the MIT License.


Support

For questions or issues, please open an issue in the repository or contact the maintainer.

About

A Python script to convert .DBF files into SQLite databases, supporting batch processing and data preservation.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages