carta/flipper-client

PostgreSQL feature flag store

gpouilloux opened this issue ยท 7 comments

Hello ๐Ÿ‘‹

At BackMarket, to integrate flipper-client in our codebase, we implemented a custom feature flag store to use PostgreSQL.

We are considering contributing this PostgreSQL feature flag store in this repository.

Would it be interesting? Is it something you would like to support in the long run?

Thanks,
Guillaume

That's great news. If you'd like to contribute, we can fast-track this. I've always known it was a matter of time until someone wanted to introduce a postgres backend.

The only thing that might require some special consideration is how we want to manage the schema migrations. But I'm sure we can figure it out.

Hey @adambom, thanks for the quick feedback.
One way would be to treat the item as bytes and rely on serialize/deserialize for creating or updating the Feature Flags. This does mean that we wouldn't be able to directly change the items in the database though.
Is this a no-go? Let us know

@manuelxarez I don't think that's necessary, unless that's what you're already doing. The other backends all use JSON serialization and I think that would work in this case.

What I'm wondering about is how we include and run the SQL statements that define the table that holds the flags. It could be something as simple as:

class PostgresFeatureFlagStore(FeatureFlagStore):
  ...

  def run_migrations(self):
    self.db.run("""CREATE TABLE feature_flag AS ...""")

Or something more complicated. That's all. Feel free to submit your PR and we'll go from there.

Hi again @adambom I'm unable to create a PR from our fork repo (https://github.com/BackMarket/flipper-client). Could this be a permission issue?

I'll have a look

I was able to create the PR on your behalf. I'll look into the permissions issues.