Download the PHP package mgcosta/mysql-to-cloud-spanner without Composer
On this page you can find all versions of the php package mgcosta/mysql-to-cloud-spanner. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mgcosta/mysql-to-cloud-spanner
More information about mgcosta/mysql-to-cloud-spanner
Files in mgcosta/mysql-to-cloud-spanner
Package mysql-to-cloud-spanner
Short Description Mysql parser to Google Cloud Spanner
License MIT
Informations about the package mysql-to-cloud-spanner
MySQL to Google Cloud Spanner Migration Tool for PHP
The MySQL Parser to Google Cloud Spanner is a library for PHP, providing an easy way to migrate the data from MySQL to Google Cloud Spanner.
Install
Via Composer
Usage Instructions
To use this toolkit, you will need an array of the columns from MySQL and the respective foreign keys / indexes.
The table array you can use the Describe
from MySQL, the foreign keys you will need to do something like that.
The library outputs a multidimensional array with following keys 'tables', 'indexes', 'constraints' to insert on the Google Cloud Spanner engine.
Note: You may want to store the constraint keys to run at the end of all tables and indexes to prevent running a constraint for a table which is not created.
Returning DDL statements without semicolons
If for some reason you need each statement without semicolon
at the end, you can use the method shouldAssignPrimaryKey
:
Dealing with schemas without Primary Keys
Since the primary key on cloud spanner is like almost required, by default if there's a table schema without PK it will generate a default column called by id which will be an int64 type. However you can modify the way this default column is created or disable it at all, for that check the following example:
Using the Dialect Service for MySQL
To help your life to fetch the data we need from MySQL to create the spanner statements, you can use the available service on your PDO or ORM / Query Builder:
This will simply generate a valid query string which you can use to fetch the columns & keys details.
The example below is Laravel based, but you can adapt it easily.
Prepare the data for migration
Sometimes you may have unexpected typed values to insert to Cloud Spanner, when you fetch the data from PHP PDOs system's, for that you can use the available transformer, which will prepare the data mapped with the described table.
For that follow the example below:
Roadmap
You can get more details of the plans for this early version on the following link.
Contributing
Please see CONTRIBUTING for details.
Credits
- [Miguel Costa][https://github.com/mgcostaParedes]
- [Mike Slowik][https://github.com/sl0wik]
License
The MIT License (MIT). Please see License File for more information.
All versions of mysql-to-cloud-spanner with dependencies
ext-json Version *
ext-grpc Version *
google/cloud-spanner Version ^1.44.0