@@ -6,6 +6,8 @@ SQL tutorial
6
6
This tutorial is a demonstration of the support for SQL in Tarantool.
7
7
It includes the functionality that you'd encounter in an "SQL-101" course.
8
8
9
+ .. sql_prereq_start
10
+
9
11
.. _sql_tutorial-prerequisites :
10
12
11
13
Prerequisites
@@ -15,63 +17,32 @@ Before starting this tutorial:
15
17
16
18
#. Install the :ref: `tt CLI <tt-installation >` utility.
17
19
18
- #. Create a tt environment in the current directory using the :ref: `tt init <tt-init >` command.
20
+ #. Start a Tarantool instance in the interactive mode by running :ref: `tt run -i <tt-run >`:
19
21
20
- #. Inside the `` instances.enabled `` directory of the created tt environment, create the `` sql_tutorial `` directory.
22
+ .. code-block :: console
21
23
22
- #. Inside ``instances.enabled/sql_tutorial ``, create the ``instances.yml `` and ``config.yaml `` files:
24
+ $ tt run -i
25
+ Tarantool 3.0.0-0-g6ba34da7f8
26
+ type 'help' for interactive help
27
+ tarantool>
23
28
24
- * `` instances.yml `` specifies instances to run in the current environment :
29
+ #. Initialize the instance and switch the input language to SQL :
25
30
26
- .. literalinclude :: /code_snippets/snippets/config/instances.enabled/instance_scope/instances.yml
27
- :language: yaml
28
- :dedent:
31
+ .. code-block :: tarantoolsession
29
32
30
- * ``config.yaml `` contains basic :ref: `configuration <configuration_file >`:
33
+ tarantool> box.cfg{}
34
+ tarantool> \set language sql
35
+ tarantool> \set delimiter ;
31
36
32
- .. literalinclude :: /code_snippets/snippets/config/instances.enabled/instance_scope/config.yaml
33
- :language: yaml
34
- :dedent:
37
+ Now you have a running Tarantool instance that accepts SQL input.
35
38
36
- Read more: :ref: ` Starting instances using the tt utility < configuration_run_instance_tt >`.
39
+ .. sql_prereq_end
37
40
38
41
.. _sql_tutorial-starting_up_with_a_first_table_and_selects :
39
42
40
43
Create a table and execute SQL statements
41
44
-----------------------------------------
42
45
43
- Start Tarantool
44
- ~~~~~~~~~~~~~~~
45
-
46
- After configuration, start a Tarantool instance from the tt environment directory using the following command:
47
-
48
- .. code-block :: console
49
-
50
- $ tt start sql_tutorial
51
-
52
- After that, connect to the instance:
53
-
54
- .. code-block :: console
55
-
56
- $ tt connect sql_tutorial:instance001
57
-
58
- This command opens an interactive Tarantool console.
59
- Now you can start working with the database.
60
-
61
- Switch to the SQL language
62
- ~~~~~~~~~~~~~~~~~~~~~~~~~~
63
-
64
- A feature of the client console program is that you can switch languages and
65
- specify the end-of-statement delimiter.
66
-
67
- Run the following commands to set the :ref: `console input <interactive_console_input_output >` language to SQL and use
68
- semicolon as a delimiter:
69
-
70
- .. code-block :: tarantoolsession
71
-
72
- sql_tutorial:instance001> \set language sql
73
- sql_tutorial:instance001> \set delimiter ;
74
-
75
46
76
47
CREATE, INSERT, UPDATE, SELECT
77
48
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0 commit comments