New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

sql2realm

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sql2realm

Command line tool to convert MySql database into Realm object database

latest
npmnpm
Version
0.0.5
Version published
Weekly downloads
5
Maintainers
1
Weekly downloads
 
Created
Source

sql2realm

Command line tool to convert MySql database into Realm object database

Build Status

the plans are to get support for mssql as for other sql adapters, so any contribution is very welcome

Getting Started

Install using yarn:

yarn global add sql2realm

Or via npm:

npm install -g sql2realm

Usage


Usage: sql2realm [config file]

Options:
  --help       Show help                                               [boolean]
  --version    Show version number                                     [boolean]
  -s, --skip   skip some tables                            [array] [default: []]
  -c, --chunk  chunk size                                       [default: 10000]

Example

let say we have Mysql server up and running and have a database named mock with a table named mock_data (see the dump)

and this is the config file config.json

{
  "mysql": {
    "host": "127.0.0.1",
    "user": "test",
    "password": "test",
    "database": "mock"
  },

  "realm": {
    "database": "./db.realm"
  },

  "tables": {
    "mock_data": {
      "schema": {
        "name": "Users",
        "primaryKey": "id",
        "properties": {
          "id": "int",
          "first_name": "string",
          "last_name": "string",
          "email": "string",
          "gender": "string",
          "ip_address": "string"
        }
      },
    }
  }
}

lets discuss config file sections one by one:

mysql connection options

"mysql": {...}

this is regular mysql/mariadb connection options

realm db options

"realm": {...}

for realm there is only one option:

  • database - path to database that will be created

Tables

this are the tables from sql to be converted into Realm

  "tables": {
    "mock_data": {
      "schema": {
  • mock_data - is the real name of table in Mysql
  • schema - is the Realm DB Schema. It should be designed according to Realm principles.

License

MIT

Keywords

sql

FAQs

Package last updated on 20 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts