-
Notifications
You must be signed in to change notification settings - Fork 60
/
datasource.jschema
562 lines (562 loc) · 16.8 KB
/
datasource.jschema
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"chType": {
"description": "Data type.",
"type": "string",
"enum": [
"Boolean",
"Int8",
"Int16",
"Int32",
"Int64",
"Int128",
"Int256",
"UInt8",
"UInt16",
"UInt32",
"UInt64",
"UInt128",
"UInt256",
"Float32",
"Float64",
"Date",
"DateTime",
"DateTime64",
"Decimal",
"Decimal32",
"Decimal64",
"Decimal128",
"Decimal256",
"Enum",
"Enum8",
"Enum16",
"IPv4",
"IPv6",
"FixedString",
"String",
"UUID"
]
},
"jdbcType": {
"description": "JDBC data type.",
"type": "string",
"enum": [
"BIT",
"TINYINT",
"SMALLINT",
"INTEGER",
"BIGINT",
"FLOAT",
"REAL",
"DOUBLE",
"NUMERIC",
"DECIMAL",
"CHAR",
"VARCHAR",
"LONGVARCHAR",
"DATE",
"TIME",
"TIMESTAMP",
"BINARY",
"VARBINARY",
"LONGVARBINARY",
"NULL",
"OTHER",
"JAVA_OBJECT",
"DISTINCT",
"STRUCT",
"ARRAY",
"BLOB",
"CLOB",
"REF",
"DATALINK",
"BOOLEAN",
"ROWID",
"NCHAR",
"NVARCHAR",
"LONGNVARCHAR",
"NCLOB",
"SQLXML",
"REF_CURSOR",
"TIME_WITH_TIMEZONE",
"TIMESTAMP_WITH_TIMEZONE"
]
},
"column": {
"description": "Column.",
"type": "object",
"properties": {
"name": {
"description": "Column name.",
"type": "string"
},
"type": {
"description": "Data type.",
"$ref": "#definitions/chType"
},
"value": {
"default": "",
"description": "Constant value in string format.",
"type": "string"
},
"nullable": {
"default": true,
"description": "Whether the columns may contain null value or not.",
"type": "boolean"
},
"precision": {
"default": 0,
"description": "Precision of decimal value.",
"type": "integer"
},
"scale": {
"default": 0,
"description": "Scale of decimal value.",
"type": "integer"
}
}
},
"columns": {
"description": "List of columns.",
"type": "array",
"items": {
"$ref": "#/definitions/column"
},
"minItems": 1
},
"converter": {
"description": "Custom data type converter.",
"type": "object",
"properties": {
"class": {
"description": "Optional Java class name of the custom type converter.",
"type": "string"
},
"mappings": {
"description": "Optional list of mapping rules.",
"type": "array",
"items": {
"type": "object",
"properties": {
"jdbcType": {
"description": "JDBC type.",
"$ref": "#definitions/jdbcType"
},
"nativeType": {
"description": "Native type.",
"type": "string"
},
"toType": {
"description": "Corresponding data type in ClickHouse.",
"$ref": "#definitions/chType"
}
},
"anyOf": [
{
"required": [
"jdbcType",
"toType"
]
},
{
"required": [
"nativeType",
"toType"
]
},
{
"required": [
"jdbcType",
"nativeType",
"toType"
]
}
]
},
"minItems": 1
}
}
},
"defaults": {
"description": "Default values.",
"type": "object",
"properties": {
"Int8": {
"default": 0,
"description": "Default value for Int8 columns.",
"type": "integer"
},
"Int16": {
"default": 0,
"description": "Default value for Int16 columns.",
"type": "integer"
},
"Int32": {
"default": 0,
"description": "Default value for Int32 columns.",
"type": "integer"
},
"Int64": {
"default": 0,
"description": "Default value for Int64 columns.",
"type": "integer"
},
"Int128": {
"default": 0,
"description": "Default value for Int128 columns.",
"type": "number"
},
"Int256": {
"default": 0,
"description": "Default value for Int256 columns.",
"type": "number"
},
"UInt8": {
"default": 0,
"description": "Default value for UInt8 columns.",
"type": "integer"
},
"UInt16": {
"default": 0,
"description": "Default value for UInt16 columns.",
"type": "integer"
},
"UInt32": {
"default": 0,
"description": "Default value for UInt32 columns.",
"type": "integer"
},
"UInt64": {
"default": 0,
"description": "Default value for UInt64 columns.",
"type": "integer"
},
"UInt128": {
"default": 0,
"description": "Default value for UInt128 columns.",
"type": "number"
},
"UInt256": {
"default": 0,
"description": "Default value for UInt256 columns.",
"type": "number"
},
"Float32": {
"default": 0,
"description": "Default value for Float32 columns.",
"type": "number"
},
"Float64": {
"default": 0,
"description": "Default value for Float64 columns.",
"type": "number"
},
"Decimal": {
"default": 0,
"description": "Default value for Decimal columns.",
"type": "number"
},
"Decimal32": {
"default": 0,
"description": "Default value for Decimal32 columns.",
"type": "number"
},
"Decimal64": {
"default": 0,
"description": "Default value for Decimal64 columns.",
"type": "number"
},
"Decimal128": {
"default": 0,
"description": "Default value for Decimal128 columns.",
"type": "number"
},
"Decimal256": {
"default": 0,
"description": "Default value for Decimal256 columns.",
"type": "number"
},
"Date": {
"default": 1,
"description": "Default value for Date columns.",
"type": "integer"
},
"DateTime": {
"default": 1,
"description": "Default value for DateTime columns.",
"type": "integer"
},
"DateTime64": {
"default": 1,
"description": "Default value for DateTime64 columns.",
"type": "number"
},
"String": {
"default": "",
"description": "Default value for String columns.",
"type": "string"
}
}
},
"parameters": {
"description": "Query parameters.",
"type": "object",
"properties": {
"fetch_size": {
"default": 1000,
"description": "JDBC fetch size, defaults to 1000.",
"type": "integer"
},
"max_rows": {
"default": 0,
"description": "Max rows to read from result sets, defaults to 0, meaning all.",
"type": "integer"
},
"null_as_default": {
"default": false,
"description": "Whether to replace null value to default value of corresponding type.",
"type": "boolean"
},
"offset": {
"default": 0,
"description": "Offset, or skip the first n rows, to start reading from result set.",
"type": "integer"
},
"position": {
"default": 0,
"description": "Absolute position of cursor to start reading from result set. 1 for first row and -1 for the last.",
"type": "integer"
},
"datasource_column": {
"default": false,
"description": "Whether to display datasource column in query result.",
"type": "boolean"
},
"custom_columns": {
"default": false,
"description": "Whether to display customized columns(defined in datasource configuration) in query results.",
"type": "boolean"
}
}
},
"datasource": {
"description": "Vendor specific datasource properties.",
"type": "object",
"properties": {
"user": {
"description": "",
"type": "string"
},
"password": {
"description": "",
"type": "string"
}
},
"additionalProperties": true,
"required": [
"user",
"password"
]
},
"hikaricp": {
"description": "HikariCP properties.",
"type": "object",
"properties": {
"type": {
"const": "jdbc"
},
"dataSource": {
"$ref": "#/definitions/datasource"
},
"dataSourceClassName": {
"description": "This is the name of the DataSource class provided by the JDBC driver.",
"type": "string"
},
"jdbcUrl": {
"description": "This property directs HikariCP to use \"DriverManager-based\" configuration.",
"type": "string"
},
"username": {
"description": "This property sets the default authentication username used when obtaining Connections from the underlying driver.",
"type": "string"
},
"password": {
"description": "This property sets the default authentication password used when obtaining Connections from the underlying driver.",
"type": "string"
},
"autoCommit": {
"default": true,
"description": "This property controls the default auto-commit behavior of connections returned from the pool.",
"type": "boolean"
},
"connectionTimeout": {
"default": 30000,
"description": "This property controls the maximum number of milliseconds that a client (that's you) will wait for a connection from the pool.",
"type": "integer"
},
"idleTimeout": {
"default": 600000,
"description": "This property controls the maximum amount of time that a connection is allowed to sit idle in the pool.",
"type": "integer"
},
"maxLifetime": {
"default": 1800000,
"description": "This property controls the maximum lifetime of a connection in the pool.",
"type": "integer"
},
"connectionTestQuery": {
"default": "select 1",
"description": "If your driver supports JDBC4 we strongly recommend not setting this property. This is for \"legacy\" drivers that do not support the JDBC4 Connection.isValid() API.",
"type": "string"
},
"minimumIdle": {
"description": "This property controls the minimum number of idle connections that HikariCP tries to maintain in the pool. Default: same as maximumPoolSize.",
"type": "integer"
},
"maximumPoolSize": {
"default": 10,
"description": "This property controls the maximum size that the pool is allowed to reach, including both idle and in-use connections.",
"type": "integer"
},
"poolName": {
"description": "This property represents a user-defined name for the connection pool and appears mainly in logging and JMX management consoles to identify pools and pool configurations. Default: auto-generated",
"type": "string"
},
"initializationFailTimeout": {
"default": 1,
"description": "This property controls whether the pool will \"fail fast\" if the pool cannot be seeded with an initial connection successfully.",
"type": "integer"
},
"isolateInternalQueries": {
"default": false,
"description": "This property determines whether HikariCP isolates internal pool queries, such as the connection alive test, in their own transaction.",
"type": "boolean"
},
"allowPoolSuspension": {
"default": false,
"description": "This property controls whether the pool can be suspended and resumed through JMX.",
"type": "boolean"
},
"readOnly": {
"default": false,
"description": "This property controls whether Connections obtained from the pool are in read-only mode by default.",
"type": "boolean"
},
"registerMbeans": {
"default": false,
"description": "This property controls whether or not JMX Management Beans (\"MBeans\") are registered or not.",
"type": "boolean"
},
"catalog": {
"description": "This property sets the default catalog for databases that support the concept of catalogs. Default: driver default",
"type": "string"
},
"schema": {
"description": "This property sets the default schema for databases that support the concept of schemas.",
"type": "string"
},
"connectionInitSql": {
"description": "This property sets a SQL statement that will be executed after every new connection creation before adding it to the pool.",
"type": "string"
},
"driverClassName": {
"description": "HikariCP will attempt to resolve a driver through the DriverManager based solely on the jdbcUrl, but for some older drivers the driverClassName must also be specified.",
"type": "string"
},
"transactionIsolation": {
"description": "This property controls the default transaction isolation level of connections returned from the pool.",
"type": "string",
"enum": [
"TRANSACTION_NONE",
"TRANSACTION_READ_COMMITTED",
"TRANSACTION_READ_UNCOMMITTED",
"TRANSACTION_REPEATABLE_READ",
"TRANSACTION_SERIALIZABLE"
]
},
"validationTimeout": {
"default": 5000,
"description": "This property controls the maximum amount of time that a connection will be tested for aliveness. This value must be less than the connectionTimeout.",
"type": "integer"
},
"leakDetectionThreshold": {
"default": 0,
"description": "This property controls the amount of time that a connection can be out of the pool before a message is logged indicating a possible connection leak. Lowest acceptable value for enabling leak detection is 2000 (2 seconds).",
"type": "integer"
}
},
"anyOf": [
{
"required": [
"dataSource"
]
},
{
"required": [
"jdbcUrl",
"username",
"password"
]
}
]
},
"entity": {
"description": "Named datasource.",
"type": "object",
"properties": {
"type": {
"description": "Type of the datasource, defaults to jdbc.",
"type": "string",
"examples": [
"jdbc"
]
},
"aliases": {
"description": "List of aliases for this datasource.",
"type": "array",
"items": {
"type": "string"
},
"minItems": 1
},
"driverUrls": {
"description": "List of URLs(or relative/absolute local paths) to find datasource driver.",
"type": "array",
"items": {
"type": "string"
},
"minItems": 1,
"examples": [
[
"drivers/clickhouse-0.2.4",
"/usr/share/java/slf4j.jar",
"https://repo1.maven.org/maven2/net/jpountz/lz4/lz4/1.3.0/lz4-1.3.0.jar"
]
]
},
"columns": {
"$ref": "#/definitions/columns"
},
"converter": {
"$ref": "#/definitions/converter"
},
"defaults": {
"$ref": "#/definitions/defaults"
},
"parameters": {
"$ref": "#/definitions/parameters"
}
},
"anyOf": [
{
"$ref": "#/definitions/hikaricp"
}
]
}
},
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/entity"
}
}