Tabular Record File Conversion Framework
Xtend
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
doc
examples
src
.gitignore
README.md
pom.xml
xrecords.asta

README.md

XRecords: Tabular Record File Conversion Framework

xrecords is a small framework for converting a wide variety of tabular data file formats including (but not limited to):

  • Relational database tables
  • Comma-separated values (CSV)
  • Delimited
  • Fixed-length
  • XML
  • DBF (Xbase)

Check the blog entry for an discussion of the framework design.

xrecords is a blackbox framework and thus can be instantiated declaratively, without programming.

File-conversion applications are written using YAML. Blackbox components can be scripted in any JVM language supported by JSR-223.

The following xrecords application populates a Postgres table from a delimited file:

source: !csvSource
    input: !fromLocation [data/acme-form4269.csv]
    fields: &myFields [
        { name: tariff, format: !integer },
        { name: desc,   format: !string  },
        { name: qty,    format: !integer },
        { name: price,  format: !double ['#,###.##'] },
        { name: origin, format: !string },
        { name: eta,    format: !date [dd/MM/yyyy] }
    ]

filter: !condition [tariff != 0] # javascript

destination: !databaseDestination
    tableName:  form4269
    columns: *myFields # CSV field names match column names
    dataSource: !!org.postgresql.ds.PGSimpleDataSource
        user: load
        password: load123
        serverName: customs.feudalia.gov
        databaseName: forms

xrecords is written in the Xtend programming language and uses the SnakeYAML and YamlTag libraries.