You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Execute multiple statements, separated by ';', individually
* Parse comments out of statements
* Execute statements sequentially, waiting for each to complete before
executing the next
Copy file name to clipboardExpand all lines: README.md
+22-2Lines changed: 22 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,5 +39,25 @@ adasql will show you information up top to help you ensure you're connecting to
39
39
40
40
Transactions are supported, though note the Data API doesn't support save points or nested transactions.
41
41
42
-
### Canceling commands
43
-
If you find yourself in the middle of a multi-line statement and wish to cancel it, enter `.clear`. This will reset the state of the REPL, though it will not affect a transaction if it is in progress.
42
+
### Multiple statements and multi-line statements
43
+
SQL statements are executed sequentially, and multiple statements can be executed when separated with the ';' delimiter. For example, the following query when executed will insert a new record and then return the same record as the first statement executes to completion before the second statement is executed:
44
+
45
+
```SQL
46
+
INSERT INTO people (id, name, age) VALUES (1, 'Alice', 39); SELECT*from mytable WHERE id =1;
47
+
```
48
+
49
+
#### Canceling commands
50
+
If you find yourself in the middle of a multi-line statement and wish to cancel it, enter `.clear`. This will reset the state of the REPL, though it will not affect a transaction if it is in progress.
51
+
52
+
## FAQ
53
+
### Can adasql be used for migrations, seeding data, or restoring backups?
54
+
Maybe! But for most use cases adasql will not work. The Aurora Data API has three issues that make migrations and restoring backups difficult:
55
+
56
+
* SQL connections to the DB used by the Data API are multiplexed, and there is no way to ensure affinity for statements that set per-connection variables. This is important when restoring backups where the backups need to execute commands like `SET FOREIGN_KEY_CHECKS=0` to disable foreign key checks when inserting records using the same connection. Multiple statements that need to be executed on the same connection with these connection-specific variables will likely fail part-way through execution.
57
+
* SQL statements larger than 64 KB are not supported. If you want to insert a batch of records, make sure they are separated into chunks of statements smaller than 64 KB.
58
+
* SQL statements that take longer than 45 seconds to complete will timeout. The adasql client does not tell the Data API to continue these statements if they do timeout for data integrity purposes. But, DDL statements that timeout may cause non-reversible changes when canceled.
59
+
60
+
Your use case may not hit these limitations, in which case have at it! But many use cases will, especially the first and second limitations when attempting to restore a mysqldump backup. You may find you can work around the limitations by:
61
+
62
+
1. Running mysqldump with the `--extended-insert=FALSE` argument to insert every record using a separate statement to keep statements under 64 KB in size
63
+
1. If your tables have foreign key constraints, you may be able to re-order them with children tables and records first, then parent tables and records second, allowing you to create tables and insert records without violating the constraints
// Comments that start like like /*! or /*!57384 contain statements that *should* be executed by MySQL clients. See https://dev.mysql.com/doc/refman/en/comments.html.
0 commit comments