Michael Carey has submitted this change and it was merged. Change subject: [ASTERIXDB-2456][DOC] Re-add insert to primer ......................................................................
[ASTERIXDB-2456][DOC] Re-add insert to primer Change-Id: I404246ea4a8568e28190cd2371356175db1471cc Reviewed-on: https://asterix-gerrit.ics.uci.edu/2983 Sonar-Qube: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Tested-by: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Contrib: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Integration-Tests: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Reviewed-by: Michael Carey <dtab...@gmail.com> --- M asterixdb/asterix-doc/src/site/markdown/sqlpp/primer-sqlpp.md 1 file changed, 30 insertions(+), 0 deletions(-) Approvals: Anon. E. Moose #1000171: Michael Carey: Looks good to me, approved Jenkins: Verified; No violations found; ; Verified 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 @@ { "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. -- To view, visit https://asterix-gerrit.ics.uci.edu/2983 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: merged Gerrit-Change-Id: I404246ea4a8568e28190cd2371356175db1471cc Gerrit-PatchSet: 2 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Ian Maxon <ima...@apache.org> Gerrit-Reviewer: Anon. E. Moose #1000171 Gerrit-Reviewer: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Gerrit-Reviewer: Michael Carey <dtab...@gmail.com>