{"id":26157214,"url":"https://github.com/profcomff/definitions-lib","last_synced_at":"2026-04-25T02:33:31.095Z","repository":{"id":280674218,"uuid":"932128447","full_name":"profcomff/definitions-lib","owner":"profcomff","description":null,"archived":false,"fork":false,"pushed_at":"2025-12-14T19:49:25.000Z","size":64,"stargazers_count":1,"open_issues_count":9,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-25T13:46:18.370Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/profcomff.png","metadata":{"files":{"readme":"README.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-02-13T12:15:28.000Z","updated_at":"2025-12-14T19:49:29.000Z","dependencies_parsed_at":"2025-03-04T18:29:33.524Z","dependency_job_id":"4b24b291-eff5-41cf-aac5-ff41f08e10ce","html_url":"https://github.com/profcomff/definitions-lib","commit_stats":null,"previous_names":["profcomff/definitions-lib"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/profcomff/definitions-lib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/profcomff%2Fdefinitions-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/profcomff%2Fdefinitions-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/profcomff%2Fdefinitions-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/profcomff%2Fdefinitions-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/profcomff","download_url":"https://codeload.github.com/profcomff/definitions-lib/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/profcomff%2Fdefinitions-lib/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32247855,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T13:21:15.438Z","status":"online","status_checked_at":"2026-04-25T02:00:06.260Z","response_time":59,"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":"2025-03-11T09:58:30.645Z","updated_at":"2026-04-25T02:33:31.069Z","avatar_url":"https://github.com/profcomff.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# definitions-lib\n\nThis is an extension library for\n[alembic](https://alembic.sqlalchemy.org/en/latest/), a database migration tool\nfor usage with SQLAlchemy.\n\n# Features\n\nNote that currently, all of the features are postgres-exclusive, and\nmaking them database-agnostic is **not** the main focus.\n\n- access group management (regular/sensitive read/write groups for each schema\n  for fine-grained access control)\n- seamless encryption (column-based encryption \u0026 decryption routines, key\n  generation, integration with access groups) \\[work in progress\\]\n- autogeneration support for each feature\n- mirrored alembic interface (suitable as a drop-in replacement)\n\n# Requirements\n\n- alembic `\u003e=1.17.2`\n- python (exact versions to be determined)\n- sqlalchemy that works with required alembic version\n\n# Installation \u0026 usage\n\nFirst of all, you need an alembic configuration, see\n[alembic docs](https://alembic.sqlalchemy.org/en/latest/tutorial.html) for setup\nsteps.\n\nAfter you have a working alembic setup, run `pip install definitions-lib`, and\nyou are done.\n\nTo use definitions-lib, simply replace `alembic` command with `python -m\ndefinitions` in your usual workflow. For example:\n\n- initialize database state: `python -m definitions init`\n- generate revision: `python -m definitions revision --autogenerate -m message`\n- e.t.c.\n\nNote: You can still use `alembic` for some commands, like\n`upgrade`/`downgrade`. But there has not been enough experimentation to know for\nsure which commands do and which do not require running `python -m definitions`\n\n# Notes for the user\n\n- Just like alembic, definitions-lib needs to generate and manage a table to\n  store metadata. Unlike alembic, this table contains records for\n  each table in your database. Additionally, definitions-lib may shadow-manage\n  some tables (key tables, for instance). For a detailed explaination, see API\n  section.\n- This table will be placed in the same schema as `alembic_version` (default\n  schema is `public`).\n\n# API\n\nAll of the magic happenes when you define additional fields in the `info`\ndict for your table (`__table_args__.info` in case of declarative definition).\n\n## sensitive\n\nTo mark table as sensitive, set `info[\"sensitive\"] = True`. This will tell\ndefinitions-lib that an additional set of read/write groups must be created for\nthe current schema. There are no additional arguments.\n\nIf `info[\"sensitive\"]` is set to `False` or removed after the sensitive groups\nare created, these groups will be dropped (unless other tables require\nthem).\n\n## encrypted\n\nTo mark table as encrypted, set `info[\"encrypted\"] = True`. In addition to that,\nyou must set `info[\"encryption\"] = param_dict`, where `param_dict` has following\nparameters:\n\n- `id: str` - identiry column name for encryption. Used to retrieve and generate\n  encryption keys (they are unique accross id columns)\n- `keys: str` - table name that stores encryption keys, in format \"{schema}.{table}\"\n  OR \"{table}\".\n- `keys_schema: str` (optional) - if `keys` does not specify schema, this parameter\n  may be used to specify it.\n- `columns: list[str]`: array of column names to be encrypted. Should never\n  contain `id`.\n\nCurrently, `keys` table must exist before encryption operation is ran, and it\nmust follow a defined structure. However, it is planned to make key table\nautomatically managed, keeping an option to manage it manually, so that the user\ndoes not have to pollute their definitions.\n\n# Current TODOs:\n\n## Encryption\n\n- [ ] Create custom CreateTableOp/DropTableOp to support shadow tables and info\n  table inserts.\n- [ ] Create render functions for encryption operations\n- [ ] Finish encryption comparators (use info table)\n\n## Tests\n\n- [ ] Write tests (using sqlalchemy.testing) ### Documentation\n- [ ] info dict API\n- [ ] docs.profcomff.com\n\n## Historical tables\n\nThis feature is to be discussed, but the basic idea is to implement TTLs for\nhistoric tables.\n\n# Contribution\n\nUntil testing suite is added, there are no guidelines.\n\nTODO: review this section.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprofcomff%2Fdefinitions-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprofcomff%2Fdefinitions-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprofcomff%2Fdefinitions-lib/lists"}