{"id":21171617,"url":"https://github.com/0k/anodb","last_synced_at":"2025-07-27T03:09:25.427Z","repository":{"id":147001738,"uuid":"58695824","full_name":"0k/anodb","owner":"0k","description":"Simple Database Anonymizer Scripting helper","archived":false,"fork":false,"pushed_at":"2016-05-13T03:24:13.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-14T17:44:26.122Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/0k.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2016-05-13T03:21:15.000Z","updated_at":"2016-11-08T20:12:29.000Z","dependencies_parsed_at":"2023-04-04T20:04:16.803Z","dependency_job_id":null,"html_url":"https://github.com/0k/anodb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/0k/anodb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0k%2Fanodb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0k%2Fanodb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0k%2Fanodb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0k%2Fanodb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0k","download_url":"https://codeload.github.com/0k/anodb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0k%2Fanodb/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267293787,"owners_count":24065326,"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","status":"online","status_checked_at":"2025-07-27T02:00:11.917Z","response_time":82,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-20T16:08:55.840Z","updated_at":"2025-07-27T03:09:25.410Z","avatar_url":"https://github.com/0k.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"=========================\nanodb\n=========================\n\n.. image:: http://img.shields.io/pypi/v/anodb.svg?style=flat\n   :target: https://pypi.python.org/pypi/anodb/\n   :alt: Latest PyPI version\n\n.. image:: http://img.shields.io/pypi/dm/anodb.svg?style=flat\n   :target: https://pypi.python.org/pypi/anodb/\n   :alt: Number of PyPI downloads\n\n.. image:: http://img.shields.io/travis/0k/anodb/master.svg?style=flat\n   :target: https://travis-ci.org/0k/anodb/\n   :alt: Travis CI build status\n\n.. image:: http://img.shields.io/coveralls/0k/anodb/master.svg?style=flat\n   :target: https://coveralls.io/r/0k/anodb\n   :alt: Test coverage\n\n\n\n``anodb`` is a Python Command Line tool to help you anonymize an existing\ndatabase.\n\n\nMaturity\n========\n\nThis code is in alpha stage. It wasn't tested on Windows. API may change.\nThis is more a draft for an ongoing reflection.\n\n\nFeatures\n========\n\nusing ``anodb``:\n\n- You can simply replace fields in your database, conditionally, with\n  other values if needed.\n\n- You can empty target tables\n\n- And these actions can be saved in a YML file that would batch all\n  these actions.\n\n- All commands support ``--dry-run`` to see what is the SQL that would\n  be executed.\n\n\nCompatibility\n=============\n\nThis code is python2 ready. It wasn't tested on windows.\n\n\nRequirements\n============\n\nYou need ``libpq-dev`` and ``libpython-dev`` package to install it, as\nit required python ``psycopg2`` to access the database:\n\n    apt-get install libpq-dev libpython-dev\n\n\nInstallation\n============\n\nYou don't need to download the GIT version of the code as ``anodb`` is\navailable on the PyPI. So you should be able to run::\n\n    pip install anodb\n\nIf you have downloaded the GIT sources, then you could add install\nthe current version via the traditional way::\n\n    python setup.py install\n\nAnd if you don't have the GIT sources but would like to get the latest\nmaster or branch from github, you could also::\n\n    pip install git+https://github.com/0k/anodb\n\nOr even select a specific revision (branch/tag/commit)::\n\n    pip install git+https://github.com/0k/anodb@master\n\n\nUsage\n=====\n\n\nDatabase access\n---------------\n\nBefore using ``anodb`` you should set up your environment for\npassword-less access to your target database. This can be done with\nseveral different ways.\n\n#. on the server side: using postgres ``pg_hba.conf`` to set password less\n   access to some specified login (RECOMMENDED ONLY ON LOCAL SOCKET ACCESS)\n\n#. on the client side, for system authentication: thanks to ``sudo``,\n   setting a password-less working ``sudo`` access to a user having\n   system authentication (typically ``sudo -u postgres``).\n\n#. on the client side, using environment variables: setting\n   ``PGUSER``, ``PGPASSWORD``, ``PGDATABASE``, ``PGHOST``,\n   ``PGPORT``...\n\n#. on the client side, using the ``~/.pgpass`` file...\n\nTo check the access is fully working you should simply test that\nlaunching ``psql`` alone will connect you without errors to the\ncorrect database.\n\nIn a unclear future, a few command line arguments could be added so\nthat you can provide directly a DSN or the necessary information to\nchoose and connect to any database.\n\nYou can also check access with ``anodb`` itself:\n\n    anodb check\n\n\nGet help\n--------\n\n    anodb --help\n\n\nReplace fields\n--------------\n\n     anodb replace fields --help\n\n\nClear Table\n-----------\n\n     anodb clear table --help\n\n\nScript\n------\n\nThe script mode allows you to batch several previous commands in a YML format\n\nThis a commented example of such a YML::\n\n    env: |     ## all values defined here will be accessible to python code\n      import hashlib\n      magic_md5 = '$1$'\n      def gen_salt( length=8, symbols=ascii_letters + digits ):\n        seed()\n        return ''.join( sample( symbols, length ) )\n    actions:   ## Batching starts: it's a list of commands\n    - clear:\n      - table:\n        - res_license\n    - replace:\n      - field:\n        - res_partner_contact:\n            name: \"'name_%s' % (id, )\"\n            last_name: \"'last_name_%s' % (id, )\"\n            first_name: \"'first_name_%s' % (id, )\"\n        - res_partner_contact:\n            --where: \"nom_marital IS NOT NULL\"\n            nom_marital: \"'nom_marital_%s' % (id, )\"\n        - res_partner_contact:\n            --where: \"birthdate IS NOT NULL\"\n            birthdate: \"'01/01/%s' % birthdate[-4:]\"\n        - res_users:\n            --where: \"login NOT IN ('admin', 'carif1')\"\n            login: \"'login_%s' % (id, )\"\n            password: encrypt('test')\n            name: \"'name_%s' % (id, )\"\n            user_email: \"'email@valeur.anonyme'\"\n        - sit_public_enquete:\n            --where: \"enqueteur IS NOT NULL\"\n            enqueteur: \"'enqueteur_%s' % (id, )\"\n        - res_company:\n            --where: \"id NOT IN (1, 963)\"\n            name: \"'company_%s' % (id, )\"\n        - sit_public_passeport_formation:\n            name: \"'name_%s' % (id, )\"\n            organisme: \"'organisme_%s' % (id, )\"\n\nThe script should be launched like this:\n\n    anodb script SCRIPT\n\n\nContributing\n============\n\nAny suggestion or issue is welcome. Push request are very welcome,\nplease check out the guidelines.\n\n\nPush Request Guidelines\n-----------------------\n\nYou can send any code. I'll look at it and will integrate it myself in\nthe code base and leave you as the author. This process can take time and\nit'll take less time if you follow the following guidelines:\n\n- check your code with PEP8 or pylint. Try to stick to 80 columns wide.\n- separate your commits per smallest concern.\n- each commit should pass the tests (to allow easy bisect)\n- each functionality/bugfix commit should contain the code, tests,\n  and doc.\n- prior minor commit with typographic or code cosmetic changes are\n  very welcome. These should be tagged in their commit summary with\n  ``!minor``.\n- the commit message should follow gitchangelog rules (check the git\n  log to get examples)\n- if the commit fixes an issue or finishes the implementation of a\n  feature, please mention it in the summary.\n\nIf you have some questions about guidelines which is not answered here,\nplease check the current ``git log``, you might find previous commit that\nwould show you how to deal with your issue.\n\n\nLicense\n=======\n\nCopyright (c) 2016 Valentin Lab.\n\nLicensed under the `BSD License`_.\n\n.. _BSD License: http://raw.github.com/0k/anodb/master/LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0k%2Fanodb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0k%2Fanodb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0k%2Fanodb/lists"}