Repository: asterixdb Updated Branches: refs/heads/master 512d8b5de -> 850d6f694
[ASTERIXDB-2456][DOC] Re-add insert to primer Change-Id: I404246ea4a8568e28190cd2371356175db1471cc Reviewed-on: https://asterix-gerrit.ics.uci.edu/2983 Sonar-Qube: Jenkins <[email protected]> Tested-by: Jenkins <[email protected]> Contrib: Jenkins <[email protected]> Integration-Tests: Jenkins <[email protected]> Reviewed-by: Michael Carey <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/850d6f69 Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/850d6f69 Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/850d6f69 Branch: refs/heads/master Commit: 850d6f6949ffc23a12b77b7c19cc48a115a6ccc9 Parents: 512d8b5 Author: Ian Maxon <[email protected]> Authored: Tue Oct 2 12:10:13 2018 -0700 Committer: Michael Carey <[email protected]> Committed: Tue Oct 2 15:51:34 2018 -0700 ---------------------------------------------------------------------- .../src/site/markdown/sqlpp/primer-sqlpp.md | 30 ++++++++++++++++++++ 1 file changed, 30 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/asterixdb/blob/850d6f69/asterixdb/asterix-doc/src/site/markdown/sqlpp/primer-sqlpp.md ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-doc/src/site/markdown/sqlpp/primer-sqlpp.md b/asterixdb/asterix-doc/src/site/markdown/sqlpp/primer-sqlpp.md index 1c78cc4..40b81d6 100644 --- a/asterixdb/asterix-doc/src/site/markdown/sqlpp/primer-sqlpp.md +++ b/asterixdb/asterix-doc/src/site/markdown/sqlpp/primer-sqlpp.md @@ -850,6 +850,36 @@ The expected result for this fuzzy join query is: { "chirp": { "chirpId": "5", "user": { "screenName": "NathanGiesen@211", "lang": "en", "friendsCount": 39339, "statusesCount": 473, "name": "Nathan Giesen", "followersCount": 49416 }, "senderLocation": point("40.09,92.69"), "sendTime": datetime("2006-08-04T10:10:00.000Z"), "referredTopics": {{ "product-w", "speed" }}, "messageText": " can't stand product-w its speed is terrible:(" }, "similarChirps": [ ] } { "chirp": { "chirpId": "8", "user": { "screenName": "NathanGiesen@211", "lang": "en", "friendsCount": 39339, "statusesCount": 473, "name": "Nathan Giesen", "followersCount": 49416 }, "senderLocation": point("46.05,93.34"), "sendTime": datetime("2005-10-14T10:10:00.000Z"), "referredTopics": {{ "product-z", "shortcut-menu" }}, "messageText": " like product-z the shortcut-menu is awesome:)" }, "similarChirps": [ ] } +## Inserting New Data ### +In addition to loading and querying data, AsterixDB supports incremental additions to datasets via the SQL++ _INSERT_ statement. + +The following example adds a new chirp by user "NathanGiesen@211" to the ChirpMessages dataset. +(An astute reader may notice that this chirp was issued a half an hour after his last chirp, so his counts +have all gone up in the interim, although he appears not to have moved in the last half hour.) + + USE TinySocial; + + INSERT INTO ChirpMessages + ( + {"chirpId": "13", + "user": + {"screenName": "NathanGiesen@211", + "lang": "en", + "friendsCount": 39345, + "statusesCount": 479, + "name": "Nathan Giesen", + "followersCount": 49420 + }, + "senderLocation": point("47.44,80.65"), + "sendTime": datetime("2008-04-26T10:10:35"), + "referredTopics": {{"chirping"}}, + "messageText": "chirpy chirp, my fellow chirpers!" + } + ); + +In general, the data to be inserted may be specified using any valid SQL++ query expression. +The insertion of a single object instance, as in this example, is just a special case where +the query expression happens to be a object constructor involving only constants. ### Deleting Existing Data ### In addition to inserting new data, AsterixDB supports deletion from datasets via the SQL++ _DELETE_ statement.
