Any built in support for reading from datastore?

2 views
Skip to first unread message

Paritosh Ranjan

unread,
Nov 22, 2010, 1:03:16 AM11/22/10
to DataCleaner-dev
Hi,

Do we have any built in support for reading from a datastore?
I see createRow methods but didn't saw any readRow.

Thanks and Regards,
Paritosh

Kasper Sørensen

unread,
Nov 22, 2010, 1:55:49 AM11/22/10
to DataCleaner-dev
Hi Paritosh,

Yes the datastore is in fact conceptually read-only. What you're
looking at must be the output writer that writes to a (hsqldb-based)
datastore.

Once you've created the datastore it should first of all appear in the
"datastores" panel in the left window of DataCleaner. Programmatically
you should get a org.eobjects.analyzer.connection.Datastore instance.
With this instance you can proceed to query the datastore using
AnalyzerBeans support for MetaModel:

Datastore datastore = ...
DataContext dc = datastore.getDataContextProvider().getDataContext();

// here's a simple example of executing a "SELECT * FROM my_table"
query
Schema schema = dc.getDefaultSchema();
Table table = schema.getTableByName("my_table");
Query q = dc.query().from(table).select(table.getColumns()).toQuery();
DataSet ds = dc.executeQuery(q);
while (ds.next()) {
System.out.println(ds.getRow());
}

Let us know if it works out for you...

/Kasper

paritosh ranjan

unread,
Nov 22, 2010, 2:42:18 AM11/22/10
to datacle...@googlegroups.com
It works.

Thanks,
Paritosh


2010/11/22 Kasper Sørensen <kas...@eobjects.dk>
--
You received this message because you are subscribed to the Google Groups "DataCleaner-dev" group.
To post to this group, send email to datacle...@googlegroups.com.
To unsubscribe from this group, send email to datacleaner-d...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/datacleaner-dev?hl=en.


Reply all
Reply to author
Forward
0 new messages