metamodel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ashwin Rayaprolu <ashwin.rayapr...@gmail.com>
Subject Re: Issue with NULL and Blank values
Date Tue, 25 Sep 2018 04:10:33 GMT
That depends on whether NULL is defined as literal in your own data
dictionary or as key word.  If you define it as keyword then there should
be an option to escape it.

This is standard practice across all protocol's to define keywords and
escape them.  Ideally it will be better if its a single character.

But as kasper said there is not a standard definition for null in official
csv protocol. It will be better for you to do post process after loading
and not complicating original csv loader.



On Mon, Sep 24, 2018 at 9:03 PM, Laxmi Lal Menaria <
menarialaxmilal@gmail.com> wrote:

> I think we should handle both, if NULL then write NULL to csv and if blank
> then write "" to csv, this will solve null vs blank.
>
> Please let me know is it possible?
>
> Thanks,
> Laxmi Lal
>
> On Tue, Sep 25, 2018 at 8:17 AM, Kasper Sørensen <
> i.am.kasper.sorensen@gmail.com> wrote:
>
> > CSV files do not have a way to represent null values, so they
> automatically
> > become blank. They're just text files and there is no way that a text
> file
> > can distinguish between a blank and a null. I guess we could introduce a
> > system property or something like that, which could turn all blanks into
> > null. But I imagine that then you would ask the inverse question about
> how
> > to represent blank strings as non-null? :-)
> >
> > Den tor. 20. sep. 2018 kl. 21.48 skrev Laxmi Lal Menaria <
> > menarialaxmilal@gmail.com>:
> >
> > > Hi All,
> > >
> > > I am trying to write MSSQL data to csv files and use Apache MetaModel
> for
> > > the same, It is working fine for most of the case but failed when I
> > restore
> > > the csv to Test database.
> > >
> > > When I compare the both database I got that BLANK values are migrated
> to
> > > NULL values. This should not happens due to data integrity.
> > >
> > > I look the metamodel code and found that it is converting the NULL
> values
> > > to BLANK
> > >
> > > (CsvInsertBuilder)
> > >
> > > for(int i = 0; i < stringValues.length; ++i) {
> > >     stringValues[i] = values[i] == null ? "" : values[i].toString();
> > > }
> > >
> > > So please let me know how can I separate both values NULL and BLANK.
> > >
> > > --
> > >
> > > Thanks,
> > > Laxmilal Menaria | +91 982 955 3793 | http://laxmilalmenaria.com/
> > >
> >
>
>
>
> --
>
> Thanks,
> Laxmilal Menaria | +91 982 955 3793 | http://laxmilalmenaria.com/
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message