Skip to content

zsvoboda/gooddata-jdbc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

91 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoodData workspace JDBC driver

JDBC driver for accessing GoodData workspace data using the standard JDBC protocol.

Getting Started

You need just this JAR file on your CLASSPATH

The JDBC driver class is

com.gooddata.jdbc.driver.AfmDriver

and it expects the following JDBC URL format

jdbc:gd://<your-gooddata-domain-name>/gdc/projects/<your-gooddata-project-id>

Supported features

  • You don't use FROM clause. Just list of columns in the SELECT <column-list> and WHERE <conditions>
  • Columns (attributes and metrics) are quoted in double-quotes ("Revenue")
    • columns can be referenced by name or by URI ([/gdc/md/w2x7a9awsioch4l9lbzgjcn99hbkm61e/obj/275])
  • Textual values are quoted in single-quotes ('Home')
  • SELECT column list
    • only supports plain list of attributes and metrics (no expressions or functions)
    • supports datatype specification using "Revenue::DECIMAL(13,2)"
  • WHERE clause
    • only supports AND logical operators
    • supports =,<>, IN, NOT IN operators for attributes
    • supports =,<>, >, <, >=, <=, BETWEEN, NOT BETWEEN operators for metrics
    • supports simple expressions like (2+5)*3
  • ORDER BY - standard support (e.g. ORDER BY 1 ASC, 2 DESC or ORDER BY "Product" ASC, "Product Category" DESC )
  • LIMIT, OFFSET standard support (e.g. LIMIT 100 OFFSET 35)
  • Prepared statements (Connection.prepareStatement + statement.setXY)
    • This is a fake implementation that does the same as execution of regular statement with parameters substitution. No performance benefits.
  • MAQL support (make sure you quote all identifiers in double quotes)
    • CREATE METRIC <name> AS <maql>
    • ALTER METRIC <name> AS <maql>
    • DROP METRIC <name>
    • DESCRIBE METRIC <name>
    • DESCRIBE VARIABLE <name>

Example

CREATE METRIC "Total Revenue by State" AS SELECT "Revenue" BY "Customer State" ALL OTHER;

SELECT "Product Category", "Customer State", "Revenue", "Total Revenue by State" 
WHERE "Customer State" IN ('CA','MA');

SELECT "Product Category", "Product", "# of Orders" ORDER BY 3 ASC LIMIT 10 OFFSET 3;

DECRIBE METRIC "Total Revenue by State";

DROP METRIC "Total Revenue by State";

Tested with

License

MIT license

Tutorials and articles

Let me know

Submit github issue.