{"id":6496,"library":"agate-dbf","title":"agate-dbf","description":"agate-dbf is a Python library that extends the `agate` data analysis library by adding robust read support for DBF (database file) files. It is currently at version 0.2.4. The library maintains an active development status, primarily releasing updates to ensure compatibility with newer Python versions.","status":"active","version":"0.2.4","language":"en","source_language":"en","source_url":"https://github.com/wireservice/agate-dbf","tags":["data analysis","dbf","agate","data parsing","tabular data"],"install":[{"cmd":"pip install agate-dbf","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Core data analysis library extended by agate-dbf.","package":"agate","optional":false},{"reason":"Underlying library used for parsing DBF files.","package":"dbfread","optional":false},{"reason":"Used for parsing ISO 8601 formatted dates and times within DBF files.","package":"isodate","optional":false}],"imports":[{"note":"Required for `agate.Table` functionality.","symbol":"agate","correct":"import agate"},{"note":"Importing `agatedbf` enables the `from_dbf` method on `agate.Table`.","symbol":"agatedbf","correct":"import agatedbf"}],"quickstart":{"code":"import agate\nimport agatedbf\nimport os\n\n# Create a dummy .dbf file for demonstration purposes\n# In a real scenario, you would already have a .dbf file.\n# For local testing, you might use a library like `dbf` or create one manually.\n# Example: (requires `pip install dbf`)\n# import dbf\n# db = dbf.Table('test.dbf', 'name C(15); age N(3,0)')\n# db.open()\n# db.append({'name': 'Alice', 'age': 30})\n# db.append({'name': 'Bob', 'age': 24})\n# db.close()\n\n# Ensure a dummy dbf file exists for this example to run.\n# We'll simulate this by checking for a non-existent file path\n# or asking the user to create one.\n\ndbf_path = 'test.dbf'\nif not os.path.exists(dbf_path):\n    print(f\"Please create a dummy DBF file named '{dbf_path}' with some data.\")\n    print(\"You can use `dbf` library for this (pip install dbf) or any other DBF creator.\")\n    print(\"Example: `db = dbf.Table('test.dbf', 'name C(15); age N(3,0)'); db.open(); db.append({'name': 'Alice', 'age': 30}); db.close()`\")\nelse:\n    table = agate.Table.from_dbf(dbf_path)\n    print(\"Table loaded successfully:\")\n    table.print_structure()\n    table.print_table(max_rows=5)\n","lang":"python","description":"This quickstart demonstrates how to load a DBF file into an `agate.Table` using the `from_dbf` method. Ensure you have a `.dbf` file available; a simple way to create one for testing is provided in the comments."},"warnings":[{"fix":"Always pass the string path to the DBF file, not a file object.","message":"`agate.Table.from_dbf()` specifically requires a file *path* string as an argument. It cannot accept an open file handle (e.g., from `open()`) due to limitations of its underlying `dbfread` dependency.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Update your code to expect column names as they appear in the DBF file (case-preserved). If lowercase names are needed, apply `.columns.lower()` manually after loading.","message":"As of version 0.2.2 (July 2020), `agate-dbf` no longer automatically lowercases column names when importing from DBF files.","severity":"breaking","affected_versions":"0.2.2 and later"},{"fix":"Upgrade `agate` to at least 1.5.0 and review usage if upgrading from versions prior to 0.2.0.","message":"Version 0.2.0 (December 2016) introduced significant internal changes, removing a monkeypatching dependency and requiring `agate` version 1.5.0 or higher. Older code relying on previous internal mechanisms or `agate` versions before 1.5.0 will break.","severity":"breaking","affected_versions":"0.2.0 and later"},{"fix":"Ensure your Python environment meets the minimum requirement specified in the `pyproject.toml` or `agate-dbf`'s documentation (currently `>=3.10`). Upgrade Python or pin `agate-dbf` to an older version compatible with your environment.","message":"Support for older Python versions is routinely dropped to align with Python's end-of-life schedule. For example, version 0.2.4 dropped support for Python 3.8 and 3.9 (December 2025), and 0.2.3 dropped support for Python 3.7 and earlier (February 2024).","severity":"breaking","affected_versions":"0.2.3 and later"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z","problems":[{"fix":"Install the package using pip: 'pip install agate-dbf'.","cause":"The 'agate-dbf' package is not installed in the Python environment.","error":"ModuleNotFoundError: No module named 'agate-dbf'"},{"fix":"Ensure 'agate-dbf' is installed and import it alongside 'agate': 'import agate; import agatedbf'.","cause":"The 'from_dbf' method is not part of the 'agate' module; it is provided by the 'agate-dbf' extension.","error":"ImportError: cannot import name 'from_dbf' from 'agate'"},{"fix":"Import 'agate-dbf' to add 'from_dbf' support: 'import agate; import agatedbf'.","cause":"The 'from_dbf' method is not an attribute of the 'agate' module; it is added by the 'agate-dbf' extension.","error":"AttributeError: module 'agate' has no attribute 'from_dbf'"},{"fix":"Provide the path to the DBF file when calling 'from_dbf': 'table = agate.Table.from_dbf('path/to/file.dbf')'.","cause":"The 'from_dbf' method requires a file path argument to specify the DBF file to read.","error":"TypeError: from_dbf() missing 1 required positional argument: 'path'"},{"fix":"Specify the correct encoding when calling 'from_dbf': 'table = agate.Table.from_dbf('file.dbf', encoding='utf-8')'.","cause":"The DBF file uses an encoding that is not supported or recognized.","error":"ValueError: Unsupported DBF file encoding"}]}