GithubHelp home page GithubHelp logo

aipescience / asciiingest Goto Github PK

View Code? Open in Web Editor NEW
6.0 6.0 1.0 664 KB

A general ASCII file row based ingestion tool using the DBIngestor library. This tool allows you to define custom ASCII data formats similar to the MS SQL Server format files. However it is possible to define custom checks, transformation functions, derived data rows, and constant data rows. It is easy to extend the assertion and convertion functions, by implementing ones own functions in the DBIngestor library. Further the DBIngestor library provided data buffering for higher ingest performance and many interfaces to various DB systems.

License: Apache License 2.0

C++ 81.57% Groff 3.21% Makefile 1.02% Visual Basic 3.37% C 0.96% CMake 9.86%

asciiingest's People

Contributors

adrpar avatar jochenklar avatar kristinriebe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

adrpar

asciiingest's Issues

Null for last column of csv-file not working

Data file contains a row with empty last column, e.g.
1,2,3,,5,
2,2,3,4,5,6

Format file: ',' as delimiter, '\n' as final delimiter.

When trying to ingest, I get following error:

ERROR IN AsciiIngest:
AsciiReader: Error in getItemInRow. You want to read more than there is available.

(Unnecessary?) Error message when using MyISAM engine with MySQL

When ingesting into a MySQL database with MyISAM engine, I get following error message:

Ingest DONE
Releasing savepoint...
ErrNr 1305: SAVEPOINT dbIngst_mysql_sp does not exist
DBMySQL: savepoint not realeased successfully.
Releasing savepoint DONE

The ingest works perfectly, all the data arrives in the database. It's just confusing to see an error when everything seems to be OK.

Inserting NULL values not working?

I've create a table like this:

CREATE TABLE test (
snapnum smallint NULL,
redshift float NULL,
BDM int NULL
) Engine=MyISAM;

and tried inserting NULL values by leaving the corresponding column empty, i.e. I have a line
1 ' ' 35123
in an ascii file (delimiter =' ' in format file) or
1,'',35123
in csv file (delimiter = ',').

Both result in:

Starting ingest...
Error in reading line 0
Problem with schema item number: 1
ERROR IN DBIngestor:
DBIngestor: Ingesting NULL in column that is set IS NOT NULL!```

Ideally, for csv it would be great, if NULL values could be written just like this:
1,,35123
but this gives a parse error:
ERROR IN AsciiIngest:
mdelimGetfield: I could not parse the data file since a given field delimiter could not be found!
Please check the format file for errors...

Ingesting files with delimiting character in a quoted column

E.g. columns like "[0,1,2]" for csv-file or "This is an example" in a space-separated file.

AsciiIngest does not respect quotes in columns, i.e. if there is a column "[0,1,2]" in a csv-file, then it will be read as 3 columns, not 1, if the delimiter is specified as comma ',' in the structure file.
Luckily it is possible to define a different delimiter for each column, so the correct delimiter could be '",' (double quotes+comma) for finding the end of the quoted columns, but AsciiIngest seems to enter an infinite loop if there is more than one delimiting character.

So currently, the work-around is:
Use delimiter ',' everywhere, then just before the quoted column: use double quote '"' as delimiter and skip the column with SKIP_THIS_COL, the part until the next double quote is the stuff that can be mapped to a field in the database, then one needs to skip again until the next comma and then one can continue as usual.
E.g. for the following data row:

1,54.6,"[0,1,2]",2.8,5

the delimiter should be:

','
','
'"' SKIP_THIS_COL
'"'
',' SKIP_THIS_COL
','
'\n'

An example is also given in this post.
Of course, it would be possible to edit the data file and use e.g. semi-colons to be on the save side. Anyway, this is a feature request, not a bug report, to:

  • allow usage of multiple different characters as delimiter
  • introduce a quote-character in addition to the delimiter character for each column

improve error message for wrong delimiters

When I provide the wrong delimiter in my format file, AsciiIngestor complains like this:

ERROR IN AsciiIngest:
mdelimGetfield: I could not parse the data file since a given field delimiter could not be found!
Please check the format file for errors...

That's great already, but it would be really nice and very helpful if AsciiIngestor could also tell explicitely which delimiter it cannot find.

When using saved variables (S), converters are applied more than once, if variable is reused

I am generating a line number using the feature of creating a "saved variable" (S-line in format file) and adding +1 for each line using CONV_ADD.
This works fine so far, however, if I reuse the S- variable more than once to ingest something into the database, then it is incremented again, i.e. CONV_ADD is applied again, so the line numbers don't fit anymore.
Is there a way to limit this to just one application of the converters?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.