Datastore with Ruby

by mmyoji

1 min read

I've been working on a project that moving lots of data (a single table) on MySQL to Google Cloud Datastore.

The API is called from Ruby on Rails with google-cloud-datastore gem

Some problems confronted me and I left memo here.

General tips

  • Set the quota from console IAM and Admin -> Quota and enable payment.
    • You cannot use the API when exceed the limits per day
  • There are some limits and you must read this at least
    • entitiy limits per Commit is 500
    • Max size of an indexed string property is 1,500 bytes
    • etc.
  • You should limit indexed properties AS POSSIBLE AS YOU CAN. This takes a lot of storage.
  • You cannot use OR and IN search in GQL.
  • null value is accepted
  • array value is accepted

Gem specified tips

You should use another language library like Golang.

  • The API of the gem to purpose exclude indexes REALLY SUCKS.
  • Passing namespace: nil applies default namespace.
  • Older versions of the gem cannot be used. (At least for me, they didn't work)