{"id":24316478,"url":"https://github.com/jferard/sqliteondbf","last_synced_at":"2025-07-20T17:32:59.716Z","repository":{"id":170593590,"uuid":"122389130","full_name":"jferard/sqliteondbf","owner":"jferard","description":"SQLite on DBF is a very simple tool that allows to get a sqlite3 connection or to process a SQL script (sqlite flavour) on a set of dBase tables (dbf files)","archived":false,"fork":false,"pushed_at":"2018-10-05T20:09:05.000Z","size":52,"stargazers_count":7,"open_issues_count":3,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-08T17:06:46.400Z","etag":null,"topics":["dbase","dbf","python","sqlite"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jferard.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-21T20:23:24.000Z","updated_at":"2024-02-02T12:26:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"ade6551f-d5d1-4ac5-8993-b36b212a5f71","html_url":"https://github.com/jferard/sqliteondbf","commit_stats":null,"previous_names":["jferard/sqliteondbf"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jferard/sqliteondbf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jferard%2Fsqliteondbf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jferard%2Fsqliteondbf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jferard%2Fsqliteondbf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jferard%2Fsqliteondbf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jferard","download_url":"https://codeload.github.com/jferard/sqliteondbf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jferard%2Fsqliteondbf/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266165725,"owners_count":23886669,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dbase","dbf","python","sqlite"],"created_at":"2025-01-17T12:56:39.567Z","updated_at":"2025-07-20T17:32:59.709Z","avatar_url":"https://github.com/jferard.png","language":"Python","readme":"===========================\nsqliteondbf - SQLite on DBF\n===========================\n\n.. image:: https://travis-ci.org/jferard/sqliteondbf.svg?branch=master\n    :target: https://travis-ci.org/jferard/sqliteondbf\n.. image:: https://codecov.io/gh/jferard/sqliteondbf/branch/master/graph/badge.svg\n    :target: https://codecov.io/gh/jferard/sqliteondbf\n\nCopyright (C) J. Férard 2018\n\nSQLite on DBF is a very simple tool that allows to get a sqlite3 connection or to process a SQL script (sqlite flavour) on a set of dBase tables (dbf files).\nUnder GPL v.3\n\nNotes:\n\n* A part of this tool was inspired by https://github.com/olemb/dbfread/blob/master/examples/dbf2sqlite by Ole Martin Bjørndalen / UiT The Arctic University of Norway (under MIT licence)\n* The example files are adapted from https://www.census.gov/data/tables/2016/econ/stc/2016-annual.html (I didn't find a copyright, but this is fair use I believe)\n\n------------\nInstallation\n------------\nWindows/Linux:\n\n.. code:: bash\n\n    [sudo] python setup.py install\n\n-------\nExample\n-------\nAs a script processor\n=====================\nAfter the installation:\n\n.. code:: bash\n\n    python -m sqliteondbf -v examples/example.sql\n\nOr\n\n.. code:: bash\n\n    sqliteondbf -v examples/example.sql\n\nIt's also possible to execute an inline command (see below for the ``$convert`` command):\n\n.. code:: bash\n\n    python -m sqliteondbf -e \"$convert 'examples' example.db 'utf-8'\"\n\nOn Linux, please escape the ``$`` sign:\n\n.. code:: bash\n\n    python -m sqliteondbf -e \"\\$convert 'examples' example.db 'utf-8'\"\n\nThis will convert all the dbf files in the ``examples`` directory and subdirectories into a sqlite3 databas names ``example.db``.\n\nAs a module\n===========\n\nIn a python script (see examples/examples.py):\n\n.. code:: python\n\n    import sqliteondbf\n\n    logging.basicConfig(level=logging.INFO)\n    connection = sqliteondbf.connect(\"path/to/dbf/dir\")\n\n    # now use the sqlite3 connection as usual\n\n----------\nThe script\n----------\nThere is a mandatory semicolon between instructions.\n\nSQL instructions\n================\nUsual SQL (sqlite flavour) instructions are simply executed on the current connection.\n\nSpecial instructions\n====================\nThere are four special instructions that begins with a ``$`` sign: ``connect``, ``convert``, ``export``, ``def``.\n\n``connect``\n-----------\nTo use a set of dbf files, type:\n\n.. code:: sql\n\n    $connect dbf path/to/files/ [encoding]\n\nThe current connection is set to an in-memory database which contains all dbf tables.\n\nTo use an existing sqlite database a source, type:\n\n.. code:: sql\n\n    $connect sqlite path/to/sqlite.db\n\nThe current connection is set to a slite database. This is equivalent to ``sqlite3.connect(\"path/to/sqlite.db\")`` in a python script.\n\n``convert``\n-----------\nSimilar to connect, but for saving the sqlite database\n\n.. code:: sql\n\n    $convert path/to/files/ path/to/sqlite.db [encoding]\n\nThe current connection to the database is set to the new sqlite database.\n\n``export``\n----------\nSave the result of the last select to a csv file:\n\n.. code:: sql\n\n    $export file.csv\n\nIf the result was already fetched, the query is rerun.\n\n``def``\n-------\nTo use a custom python function in the script:\n\n.. code:: sql\n\n    $def func(args):\n        ...\n        return ret\n\n``aggregate``\n-------------\nTo use a custom python aggregate function in the script:\n\n.. code:: sql\n\n    $aggregate Class():\n        def __init__(self):\n            ...\n\n        def step(self, v):\n            ...\n\n        def finalize(self):\n            return ret\n\n``dump``\n--------\nMake a dump of the base:\n\n.. code:: sql\n\n    $dump fname.sql\n\n``view``\n--------\nPrint the result of the last select on the terminal:\n\n.. code:: sql\n\n    $view [limit]\n\nAn optional argument ``limit`` sets the maximum number of rows to display. If ``limit`` is omitted, the its value is ``100``. If ``limit == -1``, then no limit is set.\n\nIf the result was already fetched, the query is rerun.\n\n``print``\n---------\nPrint a string or a list of string on the terminal\n\n.. code:: sql\n\n    $print something\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjferard%2Fsqliteondbf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjferard%2Fsqliteondbf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjferard%2Fsqliteondbf/lists"}