I think you're right about that. Would you be able to maybe give it a shot?
We can add a unittest for this particular case to show if it works.


2014-07-16 23:26 GMT+02:00 Júnior <[email protected]>:

> As I could see it is not possible to create without header because of this
> line on CsvCreateTableBuilder:
>
>  csvUpdateCallback.writeRow(columnNames, false);
>
> on execute method, it is always creating the header column, maybe just a if
> before that would fix that
>
>
>
> 2014-07-16 18:22 GMT-03:00 Kasper Sørensen <[email protected]
> >:
>
> > I'm just now simultaniously looking into the MM csv code ... I get the
> > feeling you're maybe a bit in untested territory. At least it seems that
> > CsvDataContextTest does not exhibit a lot of test cases around having no
> > column headers ... Might be we need your feedback here if there are
> issues.
> >
> >
> > 2014-07-16 23:19 GMT+02:00 Kasper Sørensen <
> [email protected]
> > >:
> >
> > > Ah, you want a header-less CSV file? You then need to instantiate your
> > > CsvDataContext with a CsvConfiguration that
> > > specifies CsvConfiguration.NO_COLUMN_NAME_LINE as the
> > > 'columnNameLineNumber' property. If you otherwise want defaults, that
> > would
> > > be like this:
> > >
> > > new CsvConfiguration(CsvConfiguration.NO_COLUMN_NAME_LINE);
> > >
> > >
> > > 2014-07-16 23:14 GMT+02:00 Júnior <[email protected]>:
> > >
> > > Right, what I'd like to know is to create the table without the
> header, I
> > >> think the only way would be changing the CsvCreateTableBuilder.
> > >> Thanks,
> > >>
> > >>
> > >>
> > >> 2014-07-16 18:12 GMT-03:00 Kasper Sørensen <
> > >> [email protected]>:
> > >>
> > >> > Hmm actually I just now realized that you can completely omit the
> Drop
> > >> > Table part ... if you use create table on an empty file, it will
> > simply
> > >> > create the header.
> > >> >
> > >> >
> > >> > 2014-07-16 23:10 GMT+02:00 Kasper Sørensen <
> > >> [email protected]
> > >> > >:
> > >> >
> > >> > > Yes, you do that while creating the table. Like this:
> > >> > >
> > >> > >         CsvDataContext dc = ...;
> > >> > >         dc.executeUpdate(new UpdateScript() {
> > >> > >             @Override
> > >> > >             public void run(UpdateCallback callback) {
> > >> > >
> > callback.dropTable(dc.getDefaultSchema().getTable(0));
> > >> > >
> > >> > >                 callback.createTable(dc.getDefaultSchema(),
> > >> > > "newtable").withColumn("foo").withColumn("bar").execute();
> > >> > >             }
> > >> > >         });
> > >> > >
> > >> > > (replace with your own column names of course)
> > >> > >
> > >> > >
> > >> > > 2014-07-16 23:04 GMT+02:00 Júnior <[email protected]>:
> > >> > >
> > >> > > Hi Kasper,
> > >> > >>
> > >> > >> thanks for your reply, but what about the columns?
> > >> > >>
> > >> > >> Do I need to add columns to this newly created table?
> > >> > >>
> > >> > >> Att.
> > >> > >>
> > >> > >>
> > >> > >> 2014-07-16 18:00 GMT-03:00 Kasper Sørensen <
> > >> > >> [email protected]>:
> > >> > >>
> > >> > >> > Hi there,
> > >> > >> >
> > >> > >> > There is a little known trick to get around that issue, so I
> > guess
> > >> > it's
> > >> > >> a
> > >> > >> > very fair question.
> > >> > >> >
> > >> > >> > The trick is to first do a drop table, and then a new create
> > table.
> > >> > >> >
> > >> > >> > When MM is initialized with an existing empty file, it will
> > >> determine
> > >> > >> that
> > >> > >> > there IS a table, since the file is there, but that table has
> no
> > >> > >> columns,
> > >> > >> > because the file does not define any columns. Maybe it's a bit
> > >> silly
> > >> > - I
> > >> > >> > actually think that's worth discussing ... But the reason it is
> > >> there
> > >> > >> is I
> > >> > >> > guess to indicate that at least the file is there, it's not a
> > >> > >> non-existing
> > >> > >> > file (in which case there would not be any table).
> > >> > >> >
> > >> > >> > Best regards,
> > >> > >> > Kasper
> > >> > >> >
> > >> > >> >
> > >> > >> > 2014-07-16 21:37 GMT+02:00 Júnior <[email protected]>:
> > >> > >> >
> > >> > >> > > Hi,
> > >> > >> > >
> > >> > >> > > I'm trying to use the metamodel to write on an empty csv,
> > >> > >> > >
> > >> > >> > > But I'm getting errors saying that there is no column.
> > >> > >> > >
> > >> > >> > > I was able to do that calling create table with a different
> > name
> > >> > from
> > >> > >> the
> > >> > >> > > file.
> > >> > >> > > Then added the columns.
> > >> > >> > >
> > >> > >> > > I worked, but it created the header line with the column
> names,
> > >> > would
> > >> > >> it
> > >> > >> > be
> > >> > >> > > possible to do that without adding the column names in the
> csv
> > >> file?
> > >> > >> > >
> > >> > >> > > Att.
> > >> > >> > > --
> > >> > >> > > Francisco Ribeiro
> > >> > >> > > *SCEA|SCJP|SCWCD|IBM Certified SOA Associate*
> > >> > >> > >
> > >> > >> >
> > >> > >>
> > >> > >>
> > >> > >>
> > >> > >> --
> > >> > >> Francisco Ribeiro
> > >> > >> *SCEA|SCJP|SCWCD|IBM Certified SOA Associate*
> > >> > >>
> > >> > >
> > >> > >
> > >> >
> > >>
> > >>
> > >>
> > >> --
> > >> Francisco Ribeiro
> > >> *SCEA|SCJP|SCWCD|IBM Certified SOA Associate*
> > >>
> > >
> > >
> >
>
>
>
> --
> Francisco Ribeiro
> *SCEA|SCJP|SCWCD|IBM Certified SOA Associate*
>

Reply via email to