{"id":16767077,"url":"https://github.com/davydog187/timescale","last_synced_at":"2025-04-05T23:06:31.311Z","repository":{"id":56870928,"uuid":"526778449","full_name":"davydog187/timescale","owner":"davydog187","description":"TimescaleDB made easy with Ecto","archived":false,"fork":false,"pushed_at":"2023-07-22T22:49:35.000Z","size":95,"stargazers_count":121,"open_issues_count":9,"forks_count":11,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-03-29T22:05:21.099Z","etag":null,"topics":["ecto","elixir","postgresql","time-series","timescaledb"],"latest_commit_sha":null,"homepage":"https://hexdocs.pm/timescale/Timescale.html","language":"Elixir","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/davydog187.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2022-08-19T23:32:02.000Z","updated_at":"2025-01-02T11:03:37.000Z","dependencies_parsed_at":"2024-10-26T21:12:50.452Z","dependency_job_id":"e9fc7259-22ef-40b2-99c3-71cd7dfe7afe","html_url":"https://github.com/davydog187/timescale","commit_stats":null,"previous_names":["bitfo/timescale"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davydog187%2Ftimescale","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davydog187%2Ftimescale/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davydog187%2Ftimescale/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davydog187%2Ftimescale/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davydog187","download_url":"https://codeload.github.com/davydog187/timescale/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247411229,"owners_count":20934653,"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":["ecto","elixir","postgresql","time-series","timescaledb"],"created_at":"2024-10-13T06:08:23.430Z","updated_at":"2025-04-05T23:06:31.296Z","avatar_url":"https://github.com/davydog187.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Timescale\n\n[![Build Status](https://github.com/davydog187/timescale/workflows/CI/badge.svg?branch=main)](https://github.com/davydog187/timescale/actions) [![Hex pm](https://img.shields.io/hexpm/v/timescale.svg?style=flat)](https://hex.pm/packages/timescale) [![Hexdocs.pm](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/timescale/)\n\n\u003c!-- MDOC !--\u003e\n\nExtends the [Ecto](https://hexdocs.pm/ecto/Ecto.html) DSL for easily working with [TimescaleDB](https://docs.timescale.com/). Already using Ecto and [Postgres](https://hexdocs.pm/ecto_sql/Ecto.Adapters.Postgres.html)? Great, you're all set to start working with time-series data.\n\n### Features\n\n- Easy creation of [hypertables](https://docs.timescale.com/api/latest/hypertable/) in Ecto Migrations\n- Leverage TimescaleDB [hyperfunctions](https://docs.timescale.com/api/latest/hyperfunctions/) right inside your Ecto queries\n- Configure table [compression policies](https://docs.timescale.com/api/latest/compression/)\n\n## Adding the TimescaleDB extension\n\n1. Make sure your database has Timescale correctly installed\n2. Create a new Ecto migration\n3. Call the `create_timescaledb_extension/0` and `drop_timescaledb_extension/0` in your migration\n\nE.g.\n\n```elixir\ndefmodule MyApp.Repo.Migrations.SetupTimescale do\n  use Ecto.Migration\n\n  import Timescale.Migration\n\n  def up do\n    create_timescaledb_extension()\n  end\n\n  def down do\n    drop_timescaledb_extension()\n  end\nend\n```\n\n## Using the Library\nHere is an intermediate example querying a timescale reading using Timescale [hyperfunctions](https://docs.timescale.com/api/latest/hyperfunctions/) with `timescale`'s Ecto extensions.\n\nFor a more comprehensive example you can check out our guide in the docs [here](https://hexdocs.pm/timescale/intro.html#content).\n\n```elixir\nimport Timescale.Hyperfunctions\n\nRepo.all(\n  from(h in \"heartbeats\",\n    where: h.user_id == ^alex_id,\n    group_by: selected_as(:minute),\n    select: %{\n      minute: selected_as(time_bucket(h.timestamp, \"1 minute\"), :minute),\n      bpm: count(h)\n    },\n    limit: 5\n  )\n)\n```\n\n## Installation\n\nIf [available in Hex](https://hex.pm/docs/publish), the package can be installed\nby adding `timescale` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:timescale, \"~\u003e 0.1.0\"}\n  ]\nend\n```\n\n## Installing Postgres / TimescaleDB on MacOS\n\nThere are many ways to install PostgreSQL locally, including `Postgres.app`, `Docker`, and building locally. Below is how to install through Homebrew\n\nFirst, install Postgres\n\n```shell\n$ brew install postgresql\n$ sudo chown $(whoami) /usr/local/var/postgres\n$ initdb /usrl/local/var/postgres\n$ createuser -s postgres\n$ createdb\n```\n\nMake Postgres a service that is started automatically\n\n```shell\n$ brew services start postgresql\n```\n\nThen install TimescaleDB. For more information about installing TimescaleDB on MacOS, see the [official documentation](https://docs.timescale.com/install/latest/self-hosted/installation-macos/#install-self-hosted-timescaledb-using-homebrew).\n\n```shell\n$ brew tap timescale/tap\n$ brew install timescaledb\n\n# Add the following to `/opt/homebrew/var/postgres/postgresql.conf`\nshared_preload_libraries = 'timescaledb'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavydog187%2Ftimescale","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavydog187%2Ftimescale","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavydog187%2Ftimescale/lists"}