Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support different data file types #5

Open
h-bragg opened this issue Aug 13, 2018 · 0 comments
Open

Support different data file types #5

h-bragg opened this issue Aug 13, 2018 · 0 comments

Comments

@h-bragg
Copy link

h-bragg commented Aug 13, 2018

We should support different data file types: mainly: csv, json, and yaml.

When importing we should support:

  • allow different sets of key/values between each 'row'
    • group rows based on their common sets of keys, to reduce time when inserting

Potential Solutions

  1. Convert each into .sql and import using mysql command
  2. Read the data into memory and write to the database within code

CSV

"id","country_code","country_code_iso2","country_code_iso3","name","decimal_point","thousands_separator","added","updated","deleted"
1,'AF','AF','AFG','Afghanistan','.',',','2012-09-20 12:43:09','2015-10-07 11:05:58',NULL
2,'AX','AX','ALA','Aland Islands','.',',','2012-09-20 12:43:09','2015-10-07 11:05:58',NULL
3,'AL','AL','ALB','Albania','.',',','2012-09-20 12:43:09','2015-10-07 11:05:58',NULL
4,'DZ','DZ','DZA','Algeria','.',',','2012-09-20 12:43:09','2015-10-07 11:05:58',NULL
5,'AS','AS','ASM','American Samoa','.',',','2012-09-20 12:43:09','2015-10-07 11:05:58',NULL

Yaml

schema: the_schema
table: country

data:
  - id: 1
    country_code: AF
    country_code_iso2: AF
    country_code_iso3: AFG
    name: Afghanistan
    decimal_point: '.'
    thousands_separator: ','

  - id: 2
    country_code: AX
    country_code_iso2: AX
    country_code_iso3: ALA
    name: Aland Island
    decimal_point: '.'
    thousands_separator: ','

  - id: 3
    country_code: AL
    country_code_iso2: AL
    country_code_iso3: ALB
    name: Albania
    decimal_point: '.'
    thousands_separator: ','

  - id: 4
    country_code: DZ
    country_code_iso2: DZ
    country_code_iso3: DZA
    name: Algeria
    decimal_point: '.'
    thousands_separator: ','

  - id: 5
    country_code: AS
    country_code_iso2: AS
    country_code_iso3: ASM
    name: American Samoa
    decimal_point: '.'
    thousands_separator: ','

Json

{
  "schema": "the_schema",
  "table": "country",
  "data": [
    {
      "id": 1,
      "country_code": "AF",
      "country_code_iso2": "AF",
      "country_code_iso3": "AFG",
      "name": "Afghanistan",
      "decimal_point": ".",
      "thousands_separator": ","
    },
    {
      "id": 2,
      "country_code": "AX",
      "country_code_iso2": "AX",
      "country_code_iso3": "ALA",
      "name": "Aland Island",
      "decimal_point": ".",
      "thousands_separator": ","
    },
    {
      "id": 3,
      "country_code": "AL",
      "country_code_iso2": "AL",
      "country_code_iso3": "ALB",
      "name": "Albania",
      "decimal_point": ".",
      "thousands_separator": ","
    },
    {
      "id": 4,
      "country_code": "DZ",
      "country_code_iso2": "DZ",
      "country_code_iso3": "DZA",
      "name": "Algeria",
      "decimal_point": ".",
      "thousands_separator": ","
    },
    {
      "id": 5,
      "country_code": "AS",
      "country_code_iso2": "AS",
      "country_code_iso3": "ASM",
      "name": "American Samoa",
      "decimal_point": ".",
      "thousands_separator": ","
    }
  ]
}
@h-bragg h-bragg changed the title Support different file types Support different data file types Aug 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant