Skip to content

Commit 4752157

Browse files
committed
Add TransactionIsolationLevel to sql server
1 parent 79a72f3 commit 4752157

File tree

7 files changed

+70
-0
lines changed

7 files changed

+70
-0
lines changed

mssql-plugin/docs/SQL Server-connector.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ authentication. Optional for databases that do not require authentication.
2222

2323
**Password:** Password to use to connect to the specified database.
2424

25+
**Transaction Isolation Level** The transaction isolation level of the databse connection
26+
- TRANSACTION_READ_COMMITTED: No dirty reads. Non-repeatable reads and phantom reads are possible.
27+
- TRANSACTION_SERIALIZABLE: No dirty reads. Non-repeatable and phantom reads are prevented.
28+
- TRANSACTION_REPEATABLE_READ: No dirty reads. Prevents non-repeatable reads, but phantom reads are still possible.
29+
- TRANSACTION_READ_UNCOMMITTED: Allows dirty reads (reading uncommitted changes from other transactions). Non-repeatable reads and phantom reads are possible.
30+
2531
**Authentication Type:** Indicates which authentication method will be used for the connection. Use 'SQL Login'. to
2632
connect to a SQL Server using username and password properties. Use 'Active Directory Password' to connect to an Azure
2733
SQL Database/Data Warehouse using an Azure AD principal name and password.

mssql-plugin/docs/SqlServer-batchsink.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ an Azure SQL Database/Data Warehouse using an Azure AD principal name and passwo
4646

4747
**Password:** Password to use to connect to the specified database.
4848

49+
**Transaction Isolation Level** The transaction isolation level of the databse connection
50+
- TRANSACTION_READ_COMMITTED: No dirty reads. Non-repeatable reads and phantom reads are possible.
51+
- TRANSACTION_SERIALIZABLE: No dirty reads. Non-repeatable and phantom reads are prevented.
52+
- TRANSACTION_REPEATABLE_READ: No dirty reads. Prevents non-repeatable reads, but phantom reads are still possible.
53+
- TRANSACTION_READ_UNCOMMITTED: Allows dirty reads (reading uncommitted changes from other transactions). Non-repeatable reads and phantom reads are possible.
54+
4955
**Instance Name:** SQL Server instance name to connect to. When it is not specified, a
5056
connection is made to the default instance. For the case where both the instanceName and port are specified,
5157
see the notes for port. If you specify a Virtual Network Name in the Server connection property, you cannot

mssql-plugin/docs/SqlServer-batchsource.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ an Azure SQL Database/Data Warehouse using an Azure AD principal name and passwo
5656

5757
**Password:** Password to use to connect to the specified database.
5858

59+
**Transaction Isolation Level** The transaction isolation level of the databse connection
60+
- TRANSACTION_READ_COMMITTED: No dirty reads. Non-repeatable reads and phantom reads are possible.
61+
- TRANSACTION_SERIALIZABLE: No dirty reads. Non-repeatable and phantom reads are prevented.
62+
- TRANSACTION_REPEATABLE_READ: No dirty reads. Prevents non-repeatable reads, but phantom reads are still possible.
63+
- TRANSACTION_READ_UNCOMMITTED: Allows dirty reads (reading uncommitted changes from other transactions). Non-repeatable reads and phantom reads are possible.
64+
5965
**Instance Name:** SQL Server instance name to connect to. When it is not specified, a
6066
connection is made to the default instance. For the case where both the instanceName and port are specified,
6167
see the notes for port. If you specify a Virtual Network Name in the Server connection property, you cannot

mssql-plugin/src/main/java/io/cdap/plugin/mssql/SqlServerSource.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,11 @@ public List<String> getInitQueries() {
198198
return Collections.emptyList();
199199
}
200200

201+
@Override
202+
public String getTransactionIsolationLevel() {
203+
return connection.getTransactionIsolationLevel();
204+
}
205+
201206
@Override
202207
public void validate(FailureCollector collector) {
203208
ConfigUtil.validateConnection(this, useConnection, connection, collector);

mssql-plugin/widgets/SQL Server-connector.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,19 @@
6464
"widget-type": "password",
6565
"label": "Password",
6666
"name": "password"
67+
},
68+
{
69+
"widget-type": "select",
70+
"label": "Transaction Isolation Level",
71+
"name": "transactionIsolationLevel",
72+
"widget-attributes": {
73+
"values": [
74+
"TRANSACTION_READ_COMMITTED",
75+
"TRANSACTION_REPEATABLE_READ",
76+
"TRANSACTION_SERIALIZABLE"
77+
],
78+
"default": "TRANSACTION_SERIALIZABLE"
79+
}
6780
}
6881
]
6982
},

mssql-plugin/widgets/SqlServer-batchsink.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,19 @@
8484
"label": "Password",
8585
"name": "password"
8686
},
87+
{
88+
"widget-type": "select",
89+
"label": "Transaction Isolation Level",
90+
"name": "transactionIsolationLevel",
91+
"widget-attributes": {
92+
"values": [
93+
"TRANSACTION_READ_COMMITTED",
94+
"TRANSACTION_REPEATABLE_READ",
95+
"TRANSACTION_SERIALIZABLE"
96+
],
97+
"default": "TRANSACTION_SERIALIZABLE"
98+
}
99+
},
87100
{
88101
"widget-type": "keyvalue",
89102
"label": "Connection Arguments",
@@ -280,6 +293,10 @@
280293
{
281294
"type": "property",
282295
"name": "connectionArguments"
296+
},
297+
{
298+
"type": "property",
299+
"name": "transactionIsolationLevel"
283300
}
284301
]
285302
},

mssql-plugin/widgets/SqlServer-batchsource.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,19 @@
8484
"label": "Password",
8585
"name": "password"
8686
},
87+
{
88+
"widget-type": "select",
89+
"label": "Transaction Isolation Level",
90+
"name": "transactionIsolationLevel",
91+
"widget-attributes": {
92+
"values": [
93+
"TRANSACTION_READ_COMMITTED",
94+
"TRANSACTION_REPEATABLE_READ",
95+
"TRANSACTION_SERIALIZABLE"
96+
],
97+
"default": "TRANSACTION_SERIALIZABLE"
98+
}
99+
},
87100
{
88101
"widget-type": "keyvalue",
89102
"label": "Connection Arguments",
@@ -316,6 +329,10 @@
316329
{
317330
"type": "property",
318331
"name": "connectionArguments"
332+
},
333+
{
334+
"type": "property",
335+
"name": "transactionIsolationLevel"
319336
}
320337
]
321338
},

0 commit comments

Comments
 (0)