D-SQL (DYNAMODB STRUCTURED QUERY LANGUAGE)
AUTHOR: SAID SAMADLI
DATE: 7/30/2014
VERION: V1.1
TABLE OF CONTENTS
WHAT IS D-SQL?
A query language for Amazon DYNAMODDB. D-SQL language could be used to script anything for dynamodb locally and committed to Amazon Cloud once the script is ready. Based on the terminology and convenient use of T-SQL , D-SQL is a derivative of that language. Methodology did not change. Write your own D-SQL scripts as you used to do for T-SQL and test it. Once the script is ready then commit it to the DYNOMDDB using dsqlcmd.exe tool. This project is open source and written in C# and should be cross platform. Windows version will be implemented first and along with dsqlcmd utlity. Please send requests to http://sourceforge.net/p/d-sql/tickets/?source=navbar for further enhancements. Also if you would like to join to the project kindly send me your requests. I would be glad to add you to the project.
Thanks for your contributions!
SYNTAX EXPLANATION
A D-SQL syntax is similar to T-SQL. DO clause performs specific statement if the statement ends with ; character
With same manner USE clause uses the credentials given in a file.
2.1. DO CLAUSE
Is used in conjunction with performing an operation and committing. If we give another example to this GO with SQL SERVER and / character with ORACLE could be a similar objective. As soon as dsqlcmd sees DO clause after ; character it performs the statement on the given user dynamodb and outputs the results.
2.2. USE CLAUSE
Is used in conjunction with performing an loading a user specific access and secret keys. By using USE clause we could connect to a DYNAMODB database
SELECT QUERY
Select could be used to query a table or an object from dynamodb. Syntax is below
USE C:\KEYS\CREDS.CSV
SELECT * FROM CARS;
DO
DML OPERATIONS
D-SQL language let's you use dml statements on DYNAMODB. Such as DELETE,INSERT,UPDATE queries could be used easily.
4.1. DELETE QUERY
D-SQL syntax for delete operation is
USE C:\KEYS\CREDS.CSV ON DYNAMODB;
DELETE FROM TABLE CARS WHERE ID=1;
DO
4.2. INSERT QUERY
D-SQL syntax for insert operation is below.
USE C:\KEYS\CREDS.CSV ON DYNAMODB;
INSERT INTO TABLE CARS(ID,NAME,COLOR) VALUES(1,'BUICK','BLUE');
DO
4.3. UPDATE QUERY
D-SQL syntax for update operation is below.
USE C:\KEYS\CREDS.CSV ON DYNAMODB;
UPDATE TABLE CARS SET NAME='FORD' WHERE ID=1;
DO
DDL OPERATIONS
D-SQL language let's you use ddl statements on DYNAMODB. Such as CREATE,DROP TABLE/INDEX. Logic is similar.
5.1. CREATE TABLE
D-SQL syntax for create table operation is below.
USE C:\KEYS\CREDS.CSV ON DYNAMODB;
CREATE TABLE CARS
(
ID NUMBER,
NAME STRING,
COLOR STRING,
PRIMARY ON (ID NUMBER)
);
DO
5.2. CREATE INDEX
D-SQL syntax for create index operation is below.
USE C:\KEYS\CREDS.CSV ON DYNAMODB;
CREATE INDEX ID-CARS FOR TABLE
(
ID NUMBER
);
DO
5.3. DROP TABLE
D-SQL syntax for drop table operation is below.
USE C:\KEYS\CREDS.CSV ON DYNAMODB;
DROP TABLE CARS;
DO
5.4. DROP INDEX
D-SQL syntax for drop index operation is below.
USE C:\KEYS\CREDS.CSV ON DYNAMODB;
DROP INDEX ID-CARS;
DO
5.5. COPY ROW
D-SQL syntax for copy row operation is below. Assuming we have only one row with ID=1
USE C:\KEYS\CREDS.CSV ON DYNAMODB;
COPY ROW ON TABLE CARS ONTO ID=2 WHERE ID=1
DO
APPENDIX
DO,USE,DROP INDEX,DROP TABLE,CREATE TABLE,CREATE INDEX, INSERT, SELECT, UPDATE, DELETE