Apache
MetaModel

Providing a common interface for discovery, exploration of metadata and querying of different types of data sources. With MetaModel you get a uniform connector and query API for:


PostgreSQL

MySQL

Oracle DB

SQL Server

Embedded DBs

CouchDB

MongoDB

HBase

Cassandra

ElasticSearch

SugarCRM

CSV files

Spreadsheets

MetaModel isn't a data mapping framework. Instead we emphasize abstraction of metadata and ability to add data sources at runtime, making MetaModel great for generic data processing applications, less so for applications modeled around a particular domain.

News

Download

Source: Latest source code release of MetaModel:

 

Binary: A convenient package with all MetaModel modules and dependencies as JAR binaries:

Maven dependency

Apache MetaModel is also distributed through the central Maven repository. Here's your typical <dependency> declaration:

<dependency>
  <groupId>org.apache.metamodel</groupId>
  <artifactId>MetaModel-full</artifactId>
  <version>4.3.1</version>
</dependency>

Source code

The source code for Apache MetaModel is available through this Apache Git repository:

https://git-wip-us.apache.org/repos/asf/metamodel.git

Mailing lists

To get involved with Apache MetaModel, start by joining our mailing lists and engage in the conversations!

Contributing

Please refer to our CONTRIBUTE.md file for details on contributing to Apache MetaModel.

Issue tracking

Issues for Apache MetaModel are tracked through this Apache JIRA system:

https://issues.apache.org/jira/browse/METAMODEL

Examples

Query with MetaModel

With MetaModel you use a type-safe SQL-like API for querying any datastore:

DataContext dataContext = DataContextFactory.create[TypeOfDatastore](...);
DataSet dataSet = dataContext.query()
    .from("libraries")
    .select("name")
    .where("language").eq("Java")
    .and("enhances_data_access").eq(true)
    .execute();

The MetaModel query API allows you to use the power of SQL, even on data formats such as CSV files, Excel spreadsheets, NoSQL databases and more.

Update with MetaModel

MetaModel lets you do CRUD operations on arbitrary datamodels, also in a type-safe manner. Batch updates and transactions are logically modelled as UpdateScript closures.

dataContext.executeUpdate(new UpdateScript() {
    public void run(UpdateCallback callback) {
        // CREATE a table
        Table table = callback.createTable("contributors")
            .withColumn("id").ofType(INTEGER)
            .withColumn("name").ofType(VARCHAR).execute();
            
        // INSERT INTO table
        callback.insertInto(table)
            .value("id", 1).value("name", "John Doe").execute();
        callback.insertInto(table)
            .value("name", "Jane D.").execute();
        
        // UPDATE table
        callback.update(table).value("name","Jane Doe")
            .where("id").eq(2).execute();
        
        // DELETE FROM table
        callback.deleteFrom(table).where("id").eq(1).execute();
    }
});

The rest of the API should reveal itself through using the DataContext! Javadocs, wiki, mailing lists and other resources help too of course, so check them out.

Wiki

Check out the MetaModel wiki for more in-depth examples and documentation.

Heritage

MetaModel was initially developed and released by Human Inference since 2011. In July 2013 MetaModel joined the Apache Incubator and in November 2014 MetaModel graduated to become a Top Level Project (TLP) of The Apache Foundation. It is licensed under the Apache 2.0 license.