pg-libphonenumber

A (partially implemented!) PostgreSQL extension that provides access to Google’s libphonenumber

  • Parsing/formatting/validating phone numbers for all countries/regions of the world.
  • getNumberType – gets the type of the number based on the number itself; able to distinguish Fixed-line, Mobile, Toll-free, Premium Rate, Shared Cost, VoIP and Personal Numbers (whenever feasible).
  • isNumberMatch – gets a confidence level on whether two numbers could be the same.
  • getExampleNumber/getExampleNumberByType – provides valid example numbers for all countries/regions, with the option of specifying which type of example phone number is needed.
  • isPossibleNumber – quickly guessing whether a number is a possible phonenumber by using only the length information, much faster than a full validation.
  • isValidNumber – full validation of a phone number for a region using length and prefix information.
  • AsYouTypeFormatter – formats phone numbers on-the-fly when users enter each digit.
  • findNumbers – finds numbers in text input.
  • PhoneNumberOfflineGeocoder – provides geographical information related to a phone number.
  • PhoneNumberToCarrierMapper – provides carrier information related to a phone number.

Sharding a multi-tenant app with Postgres

Co-locating data within the same physical instance avoids sending data over the network during joins. This can result in much faster operations. With Citus there are a number of ways to move your data around so you can join and query it in a flexible manner, but for this class of multi-tenant SaaS apps it’s simple if you can ensure data ends up on the shard.

Noms is a decentralized database based on ideas from Git.

Noms is different from other databases. It is:

  • Content-addressed. If you have some data you want to put into Noms, you don’t have to worry about whether it already exists. Duplicate data is automatically ignored. There is no update, only insert.
  • Append-only. When you commit data to Noms, you aren’t overwriting anything. Instead you’re adding to a historical record. By default, data is never removed from Noms. You can see the entire history of the database, diff any two commits, or rewind to any previous point in time.
  • Strongly-typed. Noms doesn’t have schemas that you design up front. Instead, each version of a Noms database has atype, which is generated automatically as you add data. You can write code against the type of a Noms database, confident that you’ve handled all the cases you need to.
  • Decentralized. If I give you a copy of my database, you and I can modify our copies disconnected from each other, and come back together and merge our changes efficiently and correctly days, weeks, or years later.

How do I dump the data of some SQLite3 tables?

<span class="pln">sqlite3 </span><span class="kwd">some</span><span class="pun">.</span><span class="pln">db </span><span class="pun">.</span><span class="kwd">schema</span> <span class="pun">></span> <span class="kwd">schema</span><span class="pun">.</span><span class="pln">sql
sqlite3 </span><span class="kwd">some</span><span class="pun">.</span><span class="pln">db </span><span class="pun">.</span><span class="kwd">dump</span> <span class="pun">></span> <span class="kwd">dump</span><span class="pun">.</span><span class="pln">sql
grep </span><span class="pun">-</span><span class="pln">vx </span><span class="pun">-</span><span class="pln">f </span><span class="kwd">schema</span><span class="pun">.</span><span class="pln">sql </span><span class="kwd">dump</span><span class="pun">.</span><span class="pln">sql </span><span class="pun">></span><span class="pln"> data</span><span class="pun">.</span><span class="pln">sql</span>