Added modern sql samples, updated readmes.

skysql
Rob Hedgpeth 2020-02-26 16:41:26 -08:00
rodzic eb9a9a6bba
commit 812215a8c5
13 zmienionych plików z 209 dodań i 5 usunięć

Wyświetl plik

@ -48,7 +48,7 @@ This sample was tested on macOS v.10.14.6.
### Getting start with MariaDB <a name="installation"></a>
To download and deploy MariaDB HTAP check out the instructions [here](https://mariadb.com/docs/deploy/installation/). You can also make use of the [MariaDB Image available on Docker Hub](https://hub.docker.com/_/mariadb).
To download and deploy MariaDB check out the instructions [here](https://mariadb.com/docs/deploy/installation/). You can also make use of the [MariaDB Image available on Docker Hub](https://hub.docker.com/_/mariadb).
### Create the schema <a name="create-schema"></a>

Wyświetl plik

@ -2,17 +2,21 @@
This repository contains samples applications demonstrating the power of MariaDB!
## [Bookings](Bookings)
## [Bookings](bookings)
**Bookings** is a web application written in [React.js](https://reactjs.org) and [Node.js](https://nodejs.org) that, backed by the power of the [MariaDB Node.js Connector](https://github.com/MariaDB/mariadb-connector-nodejs) and the [MariaDB X4 Platform](https://mariadb.com/resources/blog/deploying-mariadb-platform-x4/#smart), unleashes the power of [smart transactions](https://mariadb.com/resources/blog/introducing-mariadb-platform-x4-smart-transactions-and-cloud-native-storage/) on hundreds of millions of records with sub-second query performance without having to add any indexes!
## [Flights](Flights)
## [Flights](flights)
**Flights** is a web application written in [React.js](https://reactjs.org) and [Node.js](https://nodejs.org) that, backed by the power of the [MariaDB Node.js Connector](https://github.com/MariaDB/mariadb-connector-nodejs) and [MariaDB ColumnStore database](https://mariadb.com/docs/features/mariadb-columnstore/), allows you to analyze over 180 million [flight records from the United States Department of Transportation](https://www.transtats.bts.gov/DL_SelectFields.asp?Table_ID=236&DB_Short_Name=On-Time) in real time without needing to add any indexes!
## [Orders](Orders)
## [Modern SQL Samples](modern-sql)
[MariaDB](http://www.mariadb.com) implements more of the standard SQL specification than any other open source database, adding support for [common table expressions (CTEs)](https://mariadb.com/kb/en/with/), [window functions](https://mariadb.com/kb/en/window-functions/), [temporal data tables](https://mariadb.com/kb/en/temporal-data-tables/) and many other features over the last few years.
## [Orders](orders)
**Orders** is a web application written in [React.js](https://reactjs.org) and [Node.js](https://nodejs.org) that, backed by the power of the [MariaDB Node.js Connector](https://github.com/MariaDB/mariadb-connector-nodejs), introduces you to the power, performance, and simplicity of [MariaDB](https://mariadb.com/products/).
## [Places](Places)
## [Places](places)
**Places** is a web application written in [React.js](https://reactjs.org) and [Node.js](https://nodejs.org) that, backed by the power of the [MariaDB Node.js Connector](https://github.com/MariaDB/mariadb-connector-nodejs) and [MariaDB platform](https://mariadb.com/products/mariadb-platform/), allows you to record all of your favorite locations!
## Support and Contribution <a name="support-contribution"></a>

Wyświetl plik

@ -0,0 +1,124 @@
# Modern SQL, MariaDB, and Apache Zeppelin!
[MariaDB](http://www.mariadb.com) implements more of the standard SQL specification than any other open source database, adding support for [common table expressions (CTEs)](https://mariadb.com/kb/en/with/), [window functions](https://mariadb.com/kb/en/window-functions/), [temporal data tables](https://mariadb.com/kb/en/temporal-data-tables/) and many other features over the last few years.
<p align="center" spacing="10">
<kbd>
<img src="media/demo.gif" />
</kbd>
</p>
The following will walk you through the steps for setting up [Apache Zeppelin](https://zeppelin.apache.org/) to integrate with MariaDB and work with several samples of modern SQL functionality.
# Table of Contents
1. [Environment and Compatibility](#compatibility)
2. [Getting started with MariaDB](#overview)
1. [The Basics](#intro-mariadb)
2. [Downloading and installing MariaDB](#installation)
3. [Requirements](#requirements)
4. [Getting started with Apache Zeppelin](#getting-started)
5. [Support and Contribution](#support-contribution)
6. [License](#license)
## Environment and Compatibility <a name="compatibility"></a>
This sample was created using the following techologies:
* [MariaDB](https://mariadb.com/products/mariadb-platform/)
* [Apache Zeppelin](https://zeppelin.apache.org/)
This application was tested on [macOS Mojave v.10.14.6](https://developer.apple.com/documentation/macos_release_notes/macos_mojave_10_14_6_release_notes).
## Overview <a name="overview"></a>
### Introduction to MariaDB <a name="intro-mariadb"></a>
[MariaDB platform](https://mariadb.com/products/mariadb-platform/) unifies [MariaDB TX (transactions)](https://mariadb.com/products/mariadb-platform-transactional/) and [MariaDB AX (analytics)](https://mariadb.com/products/mariadb-platform-analytical/) so transactional applications can retain unlimited historical data and leverage powerful, real-time analytics in order to provide data-driven customers with more information, actionable insight and greater value – and businesses with endless ways to monetize data. It is the enterprise open source database for hybrid transactional/analytical processing at scale.
### Getting start with MariaDB <a name="installation"></a>
To download and deploy MariaDB check out the instructions [here](https://mariadb.com/docs/deploy/installation/). You can also make use of the [MariaDB Image available on Docker Hub](https://hub.docker.com/_/mariadb).
### Create the schema <a name="create-schema"></a>
Next you can create the schema necessary for this application by running
```
$ /<path_to>/create_schema_data.sh
```
or copying the SQL within [create_schema_data.sql](create_schema_data.sql) directly.
## Requirements <a name="requirements"></a>
This project assumes you have familiarity with building web applications using ReactJS and NodeJS technologies.
* Download and install [MariaDB](#installation).
* Download and install [Apache Zeppelin](https://zeppelin.apache.org/download.html).
* git (Optional) - this is required if you would prefer to pull the source code from GitHub repo.
- Create a [free github account](https://github.com/) if you dont already have one
- git can be downloaded from git-scm.org
## Getting started with Apache Zeppelin<a name="getting-started"></a>
### Adding a MariaDB interpreter
Once you've downloaded and installed Apache Zeppelin you will need to add a new [interpreter](https://zeppelin.apache.org/docs/0.8.2/usage/interpreter/overview.html) for MariaDB using the following steps:
1. Navigate to "Interpreter".
<p align="center" spacing="10">
<kbd>
<img src="media/interpreter.png" />
</kbd>
</p>
2. Click the "Create" button.
3. Enter a name for the interpreter and select an "Interpreter group" of `jdbc`.
<p align="center" spacing="10">
<kbd>
<img src="media/name.png" />
</kbd>
</p>
4. Assign value of **org.mariadb.jdbc.Driver** to `default.driver`.
5. Assign value of **jdbc:mariadb://<database_address>/** (where <database_address> is the location of your MariaDB database instance) to `default.url`.
6. Assign value to `default.user`.
7. Assign value to `default.password`.
8. Add the location of the [JDBC driver](https://mariadb.com/downloads/#connectors) as an artifact.
<p align="center" spacing="10">
<kbd>
<img src="media/artifact.png" />
</kbd>
</p>
### Importing the notebooks
Import the notes:
* [demo_1.json](demo_1.json)
* [demo_2.json](demo_2.json)
* [demo_3.json](demo_3.json)
by selecting "Import note".
<p align="center" spacing="10">
<kbd>
<img src="media/import.png" />
</kbd>
</p>
## Support and Contribution <a name="support-contribution"></a>
If you have any questions, comments, or would like to contribute to this or future projects like this please reach out to us directly at developers@mariadb.com or on [Twitter](https://twitter.com/mariadb).
## License <a name="license"></a>
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg?style=plastic)](https://opensource.org/licenses/Apache-2.0)

Wyświetl plik

@ -0,0 +1,73 @@
DROP TABLE IF EXISTS `supers`;
CREATE TABLE `supers` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL DEFAULT '',
`alias` varchar(50) NOT NULL DEFAULT '',
`type` char(1) NOT NULL DEFAULT '',
`rescues` int(11) NOT NULL,
`mentor` int(11) DEFAULT NULL,
`startDate` datetime NOT NULL,
`endDate` datetime NOT NULL,
PRIMARY KEY (`id`),
PERIOD FOR `date_period` (`startDate`, `endDate`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
LOCK TABLES `supers` WRITE;
INSERT INTO `supers` (`id`, `name`, `alias`, `type`, `rescues`, `mentor`, `startDate`, `endDate`)
VALUES
(1,'Bruce Wayne','Batman','H',192,6,'2016-01-01 00:00:00','2020-01-01 00:00:00'),
(2,'Clark Kent','Superman','H',257,NULL,'2016-01-01 00:00:00','2020-01-01 00:00:00'),
(3,'Diana Prince','Wonder Woman','H',212,NULL,'2016-01-01 00:00:00','2020-01-01 00:00:00'),
(4,'Dick Grayson','Robin/Nightwing','H',127,1,'2016-01-01 00:00:00','2020-01-01 00:00:00'),
(5,'Beast Boy','Gar Logan','H',59,NULL,'2016-01-01 00:00:00','2020-01-01 00:00:00'),
(6,'Ra\'s Ah Ghul','The Demon\'s Head','V',3,NULL,'2016-06-01 00:00:00','2020-01-01 00:00:00'),
(7,'Frank Castle','The Punisher','V',37,NULL,'2016-01-01 00:00:00','2020-01-01 00:00:00');
UNLOCK TABLES;
# Dump of table supersteams
# ------------------------------------------------------------
DROP TABLE IF EXISTS `supersteams`;
CREATE TABLE `supersteams` (
`supersid` int(11) unsigned NOT NULL,
`teamsid` int(11) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
LOCK TABLES `supersteams` WRITE;
INSERT INTO `supersteams` (`supersid`, `teamsid`)
VALUES
(1,1),
(2,1),
(3,1),
(4,1),
(4,2),
(5,2);
UNLOCK TABLES;
# Dump of table teams
# ------------------------------------------------------------
DROP TABLE IF EXISTS `teams`;
CREATE TABLE `teams` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
LOCK TABLES `teams` WRITE;
INSERT INTO `teams` (`id`, `name`)
VALUES
(1,'Justice League'),
(2,'Teen Titans');
UNLOCK TABLES;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Wyświetl plik

@ -0,0 +1 @@
{"paragraphs":[{"text":"%mariadb\n\n/* Temporal Table - Application Time */\n\nSELECT \n id, name, alias, type, startDate, endDate\nFROM\n demo.supers\nWHERE \n name = 'Frank Castle' \nORDER BY \n startDate","user":"anonymous","dateUpdated":"2020-02-25T18:56:13+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{"0":{"graph":{"mode":"table","height":300,"optionOpen":false,"setting":{"table":{"tableGridState":{},"tableColumnTypeState":{"names":{"id":"string","name":"string","alias":"string","type":"string","startDate":"string","endDate":"string"},"updated":false},"tableOptionSpecHash":"[{\"name\":\"useFilter\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable filter for columns\"},{\"name\":\"showPagination\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable pagination for better navigation\"},{\"name\":\"showAggregationFooter\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable a footer for displaying aggregated values\"}]","tableOptionValue":{"useFilter":false,"showPagination":false,"showAggregationFooter":false},"updated":false,"initialized":false},"lineChart":{"rotate":{"degree":"-45"},"xLabelStatus":"default"},"stackedAreaChart":{"rotate":{"degree":"-45"},"xLabelStatus":"default"},"scatterChart":{"yAxis":{"name":"startDate","index":1,"aggr":"sum"},"group":{"name":"type","index":0,"aggr":"sum"},"xAxis":{"name":"endDate","index":2,"aggr":"sum"}},"pieChart":{},"multiBarChart":{"rotate":{"degree":"-45"},"xLabelStatus":"default"}},"keys":[],"groups":[],"values":[],"commonSetting":{}},"helium":{}}},"editorSetting":{"language":"sql","editOnDblClick":false,"completionKey":"TAB","completionSupport":true},"editorMode":"ace/mode/sql"},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"TABLE","data":"id\tname\talias\ttype\tstartDate\tendDate\n17\tFrank Castle\tThe Punisher\tH\t2016-01-01 00:00:00.0\t2016-06-01 00:00:00.0\n7\tFrank Castle\tThe Punisher\tV\t2016-06-01 00:00:00.0\t2017-06-01 00:00:00.0\n18\tFrank Castle\tThe Punisher\tH\t2017-06-01 00:00:00.0\t2020-01-01 00:00:00.0\n"}]},"apps":[],"jobName":"paragraph_1582302441669_1528409790","id":"20200221-162721_22859113","dateCreated":"2020-02-21T16:27:21+0000","dateStarted":"2020-02-25T18:56:13+0000","dateFinished":"2020-02-25T18:56:13+0000","status":"FINISHED","progressUpdateIntervalMs":500,"focus":true,"$$hashKey":"object:22025"},{"text":"%mariadb\n\nUPDATE demo.supers\n FOR PORTION OF date_period\nFROM '2016-06-01' to '2017-06-01'\n SET type = 'V'\nWHERE id = 7","user":"anonymous","dateUpdated":"2020-02-25T18:56:06+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"sql","editOnDblClick":false,"completionKey":"TAB","completionSupport":true},"editorMode":"ace/mode/sql"},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"TEXT","data":"Query executed successfully. Affected rows : 1"}]},"apps":[],"jobName":"paragraph_1582320067715_487363913","id":"20200221-212107_406003971","dateCreated":"2020-02-21T21:21:07+0000","dateStarted":"2020-02-25T18:56:06+0000","dateFinished":"2020-02-25T18:56:06+0000","status":"FINISHED","progressUpdateIntervalMs":500,"$$hashKey":"object:22026"},{"text":"%mariadb\n","user":"anonymous","dateUpdated":"2020-02-25T00:54:25+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"sql","editOnDblClick":false,"completionKey":"TAB","completionSupport":true},"editorMode":"ace/mode/sql"},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1582592065740_-1031376089","id":"20200225-005425_624048741","dateCreated":"2020-02-25T00:54:25+0000","status":"READY","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:22027"}],"name":"Super Demo 3","id":"2F13T1FEP","noteParams":{},"noteForms":{},"angularObjects":{"mariadb:shared_process":[],"spark:shared_process":[]},"config":{"isZeppelinNotebookCronEnable":false,"looknfeel":"default","personalizedMode":"false"},"info":{}}

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 34 KiB

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 372 KiB

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 56 KiB

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 37 KiB

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 32 KiB

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 233 KiB