---
title: "Connecting Ruby and PostgreSQL: Timescale Integrations Expand"
published: 2025-04-14T06:04:54.000-04:00
updated: 2025-04-14T06:04:54.000-04:00
excerpt: "TimescaleDB expanded its ecosystem support, allowing you to connect PostgreSQL to Ruby. See how. Want an integration for your language? Reach out!"
tags: Announcements & Releases, PostgreSQL, Blog
authors: Jônatas Davi Paganini
---

> **TimescaleDB is now Tiger Data.**

In case you missed the quiet launch of our [timescaledb-ruby gem](https://github.com/timescale/timescaledb-ruby), we’re here to remind you that you can now connect PostgreSQL and Ruby when using TimescaleDB. 🎉 This integration delivers a deeply integrated experience that will feel natural to Ruby and Rails developers. 

PostgreSQL has long embraced language independence, but we understand that every developer community brings its own preferences, practices, and expectations when working with databases. Seamless database integration leads to faster data access, better performance, and greater scalability, so our goal is clear: support developers in their current environments and make TimescaleDB feel like a native part of any PostgreSQL workflow, no matter the programming language they use.

This integration journey began with Ruby and the [continuous aggregates macro](https://www.timescale.com/blog/building-a-better-ruby-orm-for-time-series-and-analytics), which lets you easily define real-time materialized views that automatically stay up to date as new data comes in—with a single line of Ruby code. However, we have since expanded it to [PHP](https://www.timescale.com/blog/connecting-php-and-postgresql) and [TypeScript](https://www.timescale.com/blog/connecting-typescript-and-postgresql), with the great help of our community ♥️.

## How to Connect Ruby and PostgreSQL

I believe SQL is cool, but developers prefer to write their favorite programming language. That was also my case as a Rubyist (👋, it’s Jônatas, developer advocate at Timescale!). Ruby is a dynamic, open-source programming language known for its simplicity and readability, making it ideal for building clean, maintainable code quickly. 

With our Ruby/PostgreSQL/TimescaleDB integration, you’ll get:

-   Native ActiveRecord extensions for TimescaleDB features
-   Simplified configuration and migration tooling
-   Performance optimization patterns tailored to Ruby applications
-   Comprehensive documentation with Ruby-specific examples

The [timescaledb-ruby](https://github.com/timescale/timescaledb-ruby) library works by adding conveniences to the ActiveRecord migrations and models. 

For example, the [create\_table](https://guides.rubyonrails.org/active_record_migrations.html) method used in migration can also receive the hypertable argument, which enables you to configure all TimescaleDB data lifecycles during the table creation process. 

Let’s have a look at our Ruby setup. Select the code in the tab to see other examples in [PHP](https://www.timescale.com/blog/connecting-php-and-postgresql) and [TypeScript](https://www.timescale.com/blog/connecting-typescript-and-postgresql).

-   Ruby
-   TypeScript
-   PHP

```


hypertable_options = {
  time_column: 'created_at',        # partition data by this column
  chunk_time_interval: '1 day',     # create a new table for each day
  compress_segmentby: 'identifier', # columnar compression key
  compress_after: '7 days',         # start compression after 7 days
  compress_orderby: 'created_at DESC', # compression order
  drop_after: '6 months'            # delete data after 6 months
}

create_table(:events, id: false, hypertable: hypertable_options) do |t|
  t.timestamptz :created_at, null: false
  t.string :identifier, null: false
  t.jsonb :payload
end
```

```

import { Entity, PrimaryColumn } from 'typeorm';
import { Hypertable, TimeColumn } from '@timescaledb/typeorm';

@Entity('page_loads')
@Hypertable({
  compression: { // Optional compression
    compress: true,
    compress_orderby: 'time',
    compress_segmentby: 'user_agent',
    policy: {
      schedule_interval: '7 days',
    },
  },
})
export class PageLoad {
  @PrimaryColumn({ name: 'user_agent', type: 'varchar' })
  userAgent!: string;

  @TimeColumn()
  time!: Date;
}
      
```

```

return new class extends Migration
{
    public function up(): void
    {
        Schema::createExtensionIfNotExists('timescaledb');

        Schema::create('visits', function (Blueprint $table) {
            $table->identity();
            $table->bigInteger('website_id');
            $table->text('url');
            $table->float('duration');
            $table->timestampTz('created_at');

            $table->primary(['id', 'created_at']);
            $table->index(['website_id', 'created_at']);

            $table->timescale(
                new CreateHypertable('created_at', '1 day'),
                new CreateReorderPolicyByIndex('website_id', 'created_at'),
                new EnableCompression(segmentBy: 'website_id'),
                new CreateCompressionPolicy('3 days'),
                new CreateRetentionPolicy('1 year'),
                new EnableChunkSkipping('id'),
            );
        });

        Schema::continuousAggregate('visits_agg', function(CaggBlueprint $table) {
            $table->as("
                SELECT
                    time_bucket('1 hour', created_at) AS bucket,
                    website_id,
                    url,
                    SUM(duration) AS duration
                FROM visits
                GROUP BY bucket, website_id, url
            ");
            $table->realtime();
            $table->index(['website_id','url']);

            $table->timescale(
                new CreateRefreshPolicy('5 minutes', '1 days', '2 hours'),
                new EnableCompression(),
                new CreateCompressionPolicy('2 days'),
            );
        });
    }
};

      
```

If you like this library, consider giving it a star: [https://github.com/timescale/timescaledb-ruby](https://github.com/timescale/timescaledb-ruby) ⭐️

## More PostgreSQL Integrations: PHP, TypeScript, and More

Building on the foundation of our Ruby integration, [we've already expanded to TypeScript](https://www.timescale.com/blog/connecting-typescript-and-postgresql) with our official [timescaledb-ts package](https://github.com/timescale/timescaledb-ts), which provides seamless integration with [TypeORM](https://typeorm.io/). Meanwhile, [the PHP community has embraced TimescaleDB](https://www.timescale.com/blog/connecting-php-and-postgresql) through the community-maintained [Laravel PostgreSQL Enhanced package](https://github.com/tpetry/laravel-postgresql-enhanced?tab=readme-ov-file#supported-extensions) (thanks to Tobias Petry!), bringing powerful time-series capabilities to Laravel applications.

This isn't just about specific languages—it's about creating a blueprint for how TimescaleDB can integrate seamlessly with any language ecosystem, whether through our official packages or community-led initiatives.

## Why Language-Specific Integrations Matter

While TimescaleDB works with any language that connects to PostgreSQL, we believe in going beyond basic compatibility. Language-specific integrations deliver a number of benefits:

-   **Idiomatic implementations** that follow community best practices
-   **Simplified developer experience** with familiar patterns and tooling
-   **Performance optimizations** tailored to language-specific ORMs and drivers
-   **Documentation that speaks your language**, with relevant examples and use cases

Our goal isn't just to be _compatible_ with your stack—it's to become an essential, natural extension of it.

Want to create your own integration? Read [the integration guide](https://github.com/timescale/docs/pull/3718/files).

## Join Us: We're Supporting Community Integrations

Here's where you come in. We're actively seeking developers who want to build and maintain TimescaleDB integrations for their language communities. Whether you're passionate about Python, Go, Rust, PHP, JavaScript, Java, .NET, or any other ecosystem, we want to support your efforts.

Here's what we're offering to community integration maintainers:

-   **Technical support** from our DevRel team
-   **Co-marketing opportunities** to showcase your integration
-   **Documentation collaboration** to ensure comprehensive coverage
-   **Conference and meetup sponsorship** for community education
-   **Early access to new features** to keep integrations current

If you’re interested, book a [Technical Office Hours call](https://timescale.com/office-hours) with me (Jônatas, developer advocate at Timescale), and let’s start!

## Real-World Impact and Resources

As part of this initiative, I presented "[The PostgreSQL Performance Workshop for Rubyists](https://ideia.me/tropical-on-rails-2025-a-celebration-of-ruby-community)" at a few conferences, including Tropical on Rails in São Paulo, Brazil. I shared some of the workshop’s takeaways in my personal blog, along with a [Ruby ORM benchmark](https://ideia.me/benchmarking-ruby-orms) that compared the performance of ActiveRecord versus Sequel.

To provide you with even more educational resources, we're bringing Ruby to the Timescale blog and showing the real-world impact of these integrations. Check out this article from an early developer adopter of the [timescaledb gem](https://github.com/timescale/timescaledb-ruby) on [how to set up a dashboard for global energy data analytics](https://www.timescale.com/blog/how-to-set-up-a-dashboard-for-global-energy-data-analytics-real-world-use-case). 

## Our Roadmap: What's Next

We're approaching this ecosystem expansion methodically. Throughout this process, you can expect to see us document our approach, share best practices, and create reusable patterns that make TimescaleDB integration consistent across languages while remaining idiomatic to each.

### Community engagement and support

We're committed to building a strong community around TimescaleDB and fostering broader ecosystem development. Here's how we plan to engage and support developers throughout our expansion:

-   **Open collaboration and contribution:** We welcome developers to actively participate in shaping the future of TimescaleDB integrations. Share your ideas, expertise, and code contributions to help build a robust ecosystem that benefits everyone.
-   **Community events and workshops:** We'll host and participate in events and workshops to connect with developers, share insights, and provide hands-on support for TimescaleDB integration.
-   **Project sponsorship and grants:** We're excited to sponsor open-source projects and initiatives that align with our mission of making time-series data accessible and easy to work with.
-   **Developer support and Office Hours:** Our team is dedicated to providing timely and helpful support to developers integrating TimescaleDB into their projects. [Reach out to us anytime](https://timescale.com/office-hours), and we'll do our best to assist you.

Through these initiatives, we aim to create an inclusive community where developers can learn, collaborate, and build amazing applications with TimescaleDB.

## Get Involved

At Timescale, we believe real-time analytics is part of any data-driven business, which translates into time-series data everywhere. Developers in every language community deserve first-class tools to work with this demanding workload. By expanding our ecosystem support and embracing community-led integrations, we're creating a more inclusive and powerful platform for all developers.

Join us in this mission! Here’s how you can get involved:

1.  **Join our** [**community**](https://www.timescale.com/community) and connect with the Ecosystem team.
2.  **Check out our** [**integration development guidelines**](https://github.com/timescale/integration-guidelines)**.**
3.  [**Book a session**](https://www.timescale.com/office-hours) **with our technical team.**

* * *

_Are you building an integration for TimescaleDB in your preferred language? We'd love to hear about it! Share your project or_ [_reach out to our Ecosystem team directly_](https://slack.timescale.com)_._