{"id":15559709,"url":"https://github.com/felixschwarz/column-alchemy","last_synced_at":"2026-03-09T19:36:04.035Z","repository":{"id":62563768,"uuid":"205805516","full_name":"FelixSchwarz/column-alchemy","owner":"FelixSchwarz","description":"ColumnAlchemy: additional column types for SQLAlchemy","archived":false,"fork":false,"pushed_at":"2025-01-17T12:52:40.000Z","size":83,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T16:54:45.282Z","etag":null,"topics":["database","python","sqlalchemy"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FelixSchwarz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-UTCDateTime.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-09-02T07:56:48.000Z","updated_at":"2025-01-17T12:52:18.000Z","dependencies_parsed_at":"2022-11-03T16:00:26.296Z","dependency_job_id":"6de15219-0fef-471a-8b82-2f17e2857cec","html_url":"https://github.com/FelixSchwarz/column-alchemy","commit_stats":{"total_commits":50,"total_committers":1,"mean_commits":50.0,"dds":0.0,"last_synced_commit":"ed3ad8760b86bc1f28f136085a68572bd87baae4"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FelixSchwarz%2Fcolumn-alchemy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FelixSchwarz%2Fcolumn-alchemy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FelixSchwarz%2Fcolumn-alchemy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FelixSchwarz%2Fcolumn-alchemy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FelixSchwarz","download_url":"https://codeload.github.com/FelixSchwarz/column-alchemy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248280052,"owners_count":21077409,"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":["database","python","sqlalchemy"],"created_at":"2024-10-02T15:55:54.191Z","updated_at":"2026-03-09T19:36:03.974Z","avatar_url":"https://github.com/FelixSchwarz.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nThis repo contains a **custom column types for SQLAlchemy** which I use in different projects.\n\nThe code should be **compatible with SQLAlchemy 1.2.3 - 2.0** and **Python 3.6 - 3.13** as well as **pypy 3.9**.\n\n    pip install ColumnAlchemy\n\n\nUTCDateTime\n-----------\n\n`UTCDateTime` stores a Python tz-aware `datetime.datetime` value as UTC datetime in the database (without explicit timezone information). I use this to introduce tz-aware timezones in systems which expect \"naive\" datetimes in the database.\n\n    from schwarz.column_alchemy import UTCDateTime\n\n    class Foo(Base)\n        __tablename__ = 'foo'\n        id = Column(Integer, autoincrement=True, primary_key=True)\n        timestamp = Column(UTCDateTime)\n\n\nShiftedDecimal\n--------------\n\n`ShiftedDecimal` stores a `Decimal` as integer in the database (with limited precision). This is especially useful to store decimal values even in sqlite which requires special treatment to store decimals.\n\n    from decimal import Decimal\n    from schwarz.column_alchemy import ShiftedDecimal\n\n    class Foo(Base)\n        __tablename__ = 'foo'\n        id = Column(Integer, autoincrement=True, primary_key=True)\n        percentage = Column(ShiftedDecimal(4))\n    \n    foo = Foo(percentage=Decimal('1.2324'))\n    # stores percentage as 12324 in the database but returns the\n    # correct Decimal value after loading.\n\n\nValuesEnum\n-----------\nTODO\n\nIntValuesEnum\n-------------\nTODO\n\n\nYearMonthColumn\n---------------\n\n`YearMonth` is similar to `datetime.date` but without a `day` attribute. It can be used to represent a calendar month and provides some convenience methods like `first_date_of_month()` and `last_date_of_month()`. A **`YearMonthColumn`** stores a `YearMonth` instance as \"YYYY-MM\" in the database.\n\n    from schwarz.column_alchemy import YearMonth, YearMonthColumn\n\n    class Foo(Base)\n        __tablename__ = 'foo'\n        id = Column(Integer, autoincrement=True, primary_key=True)\n        month = Column(YearMonthColumn())\n\n    foo = Foo(month=YearMonth(2020, 7))\n    # stores \"month\" as \"2020-07\" in the database but returns a\n    # YearMonth instance after loading.\n\n\nYearMonthIntColumn\n------------------\n\nVery similar to `YearMonthColumn` but stores `YearMonth(2020, 7)` as `202007` (integer).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelixschwarz%2Fcolumn-alchemy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffelixschwarz%2Fcolumn-alchemy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelixschwarz%2Fcolumn-alchemy/lists"}