2017 © Pedro Peláez
 

library import

Import CSV/XLS files

image

lephare/import

Import CSV/XLS files

  • Monday, June 25, 2018
  • by erichard
  • Repository
  • 3 Watchers
  • 2 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 50 % Grown

The README.md

Import

Resources

Archive

Archive affects imported files/resources when a ImportEvents::POST_COPY event is triggered., (*1)

For archive to take effect on a imported resource, you need to explicitly define:, (*2)

  • the archive.enabled value to true
  • the resources.references.load node
name: stock
source_dir: "var/exchange/in"

archive:
    enabled: true
    dir: "var/exchange/in/foo/stock"
    rotation: 60

resources:
    references:
        tablename: import.stock
        load:
            pattern: "^stock.csv$"

The file will move to a default archives directory in the defined source_dir or in the archive.dir if you explicitly define its value., (*3)

The archive.rotation define define the number of files to keep before deletion., (*4)

Quarantine

Quarantine affects imported files/resources when a ImportEvents::EXCEPTION event is triggered (before), (*5)

For quarantine to take effect on a imported resource, you need to explicitly define:, (*6)

  • the quarantine.enabled value to true
  • the resources.references.load node

The subsequent stock.csv file will be quarantined if an import exception happen during the import process., (*7)

name: stock
source_dir: "var/exchange/in"

quarantine:
    enabled: true
    dir: "var/exchange/in/bar/stock"
    rotation: 60

resources:
    references:
        tablename: import.stock
        load:
            pattern: "^stock.csv$"

The file will move to a default quarantine directory in the defined source_dir or in the quarantine.dir value if you explicitly define its value., (*8)

The quarantine.rotation define define the number of files to keep before deletion., (*9)

IDE Integration

Beyond validating YAML syntax in your IDE, you can validate the definition of an import configuration using the JSON schema ./lephare-import.schema.json., (*10)

This also provides contextual help for autocompletion and when hovering over a YAML key., (*11)

The Versions