Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
njgzx
dataease
Commits
308a0f93
提交
308a0f93
authored
11月 01, 2021
作者:
taojinlong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: redshift
上级
e012c76e
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
88 行增加
和
6 行删除
+88
-6
DatasourceTypes.java
...ava/io/dataease/datasource/constants/DatasourceTypes.java
+3
-1
RedshiftConfigration.java
...java/io/dataease/datasource/dto/RedshiftConfigration.java
+20
-0
JdbcProvider.java
...in/java/io/dataease/datasource/provider/JdbcProvider.java
+12
-0
QueryProvider.java
...end/src/main/java/io/dataease/provider/QueryProvider.java
+2
-2
RedshiftConstants.java
...java/io/dataease/provider/redshift/RedshiftConstants.java
+49
-0
RedshiftQueryProvider.java
.../io/dataease/provider/redshift/RedshiftQueryProvider.java
+0
-0
ExtractDataService.java
.../java/io/dataease/service/dataset/ExtractDataService.java
+1
-3
redshift-jdbc42-2.1.0.1.jar
drivers/redshift-jdbc42-2.1.0.1.jar
+0
-0
form.vue
frontend/src/views/system/datasource/form.vue
+1
-0
没有找到文件。
backend/src/main/java/io/dataease/datasource/constants/DatasourceTypes.java
浏览文件 @
308a0f93
...
...
@@ -11,7 +11,9 @@ public enum DatasourceTypes {
oracle
(
"oracle"
,
"oracle"
,
"oracle.jdbc.driver.OracleDriver"
,
"\""
,
"\""
,
"\""
,
"\""
),
mongo
(
"mongo"
,
"mongodb"
,
"com.mongodb.jdbc.MongoDriver"
,
"`"
,
"`"
,
"\""
,
"\""
),
ck
(
"ch"
,
"ch"
,
"ru.yandex.clickhouse.ClickHouseDriver"
,
"`"
,
"`"
,
"'"
,
"'"
),
es
(
"es"
,
"es"
,
""
,
"\""
,
"\""
,
"\""
,
"\""
);
es
(
"es"
,
"es"
,
""
,
"\""
,
"\""
,
"\""
,
"\""
),
redshift
(
"redshift"
,
"redshift"
,
"org.postgresql.Driver"
,
"\""
,
"\""
,
"\""
,
"\""
);
private
String
feature
;
private
String
desc
;
...
...
backend/src/main/java/io/dataease/datasource/dto/RedshiftConfigration.java
0 → 100644
浏览文件 @
308a0f93
package
io
.
dataease
.
datasource
.
dto
;
import
lombok.Getter
;
import
lombok.Setter
;
@Getter
@Setter
public
class
RedshiftConfigration
extends
JdbcConfiguration
{
private
String
driver
=
"com.amazon.redshift.jdbc42.Driver"
;
public
String
getJdbc
()
{
// 连接参数先写死,后边要把编码、时区等参数放到数据源的设置中
return
"jdbc:redshift://HOSTNAME:PORT/DATABASE"
.
replace
(
"HOSTNAME"
,
getHost
().
trim
())
.
replace
(
"PORT"
,
getPort
().
toString
().
trim
())
.
replace
(
"DATABASE"
,
getDataBase
().
trim
());
}
}
\ No newline at end of file
backend/src/main/java/io/dataease/datasource/provider/JdbcProvider.java
浏览文件 @
308a0f93
...
...
@@ -453,6 +453,12 @@ public class JdbcProvider extends DatasourceProvider {
case
ck:
CHConfiguration
chConfiguration
=
new
Gson
().
fromJson
(
datasourceRequest
.
getDatasource
().
getConfiguration
(),
CHConfiguration
.
class
);
return
"SELECT name FROM system.tables where database='DATABASE';"
.
replace
(
"DATABASE"
,
chConfiguration
.
getDataBase
());
case
redshift:
RedshiftConfigration
redshiftConfigration
=
new
Gson
().
fromJson
(
datasourceRequest
.
getDatasource
().
getConfiguration
(),
RedshiftConfigration
.
class
);
if
(
StringUtils
.
isEmpty
(
redshiftConfigration
.
getSchema
())){
throw
new
Exception
(
Translator
.
get
(
"i18n_schema_is_empty"
));
}
return
"SELECT tablename FROM pg_tables WHERE schemaname='SCHEMA' ;"
.
replace
(
"SCHEMA"
,
redshiftConfigration
.
getSchema
());
default
:
return
"show tables;"
;
}
...
...
@@ -487,6 +493,12 @@ public class JdbcProvider extends DatasourceProvider {
throw
new
Exception
(
Translator
.
get
(
"i18n_schema_is_empty"
));
}
return
"SELECT viewname FROM pg_views WHERE schemaname='SCHEMA' ;"
.
replace
(
"SCHEMA"
,
pgConfiguration
.
getSchema
());
case
redshift:
RedshiftConfigration
redshiftConfigration
=
new
Gson
().
fromJson
(
datasourceRequest
.
getDatasource
().
getConfiguration
(),
RedshiftConfigration
.
class
);
if
(
StringUtils
.
isEmpty
(
redshiftConfigration
.
getSchema
())){
throw
new
Exception
(
Translator
.
get
(
"i18n_schema_is_empty"
));
}
return
"SELECT viewname FROM pg_views WHERE schemaname='SCHEMA' ;"
.
replace
(
"SCHEMA"
,
redshiftConfigration
.
getSchema
());
default
:
return
null
;
}
...
...
backend/src/main/java/io/dataease/provider/QueryProvider.java
浏览文件 @
308a0f93
...
...
@@ -86,7 +86,7 @@ public abstract class QueryProvider {
}
}
public
String
convertTableToSql
(
String
tableName
,
Datasource
ds
)
{
return
"select * from
tableName"
;
public
String
convertTableToSql
(
String
tableName
,
Datasource
ds
){
return
"select * from
TABLE_NAME"
.
replace
(
"TABLE_NAME"
,
tableName
)
;
}
}
backend/src/main/java/io/dataease/provider/redshift/RedshiftConstants.java
0 → 100644
浏览文件 @
308a0f93
package
io
.
dataease
.
provider
.
redshift
;
import
io.dataease.provider.SQLConstants
;
import
static
io
.
dataease
.
datasource
.
constants
.
DatasourceTypes
.
pg
;
/**
* Redshift 静态变量
*
* @className: RedshiftConstants
* @description: Redshift 静态变量
* @author: Jiantao Yan
* @date: 2021/10/11 17:12
**/
public
class
RedshiftConstants
extends
SQLConstants
{
public
static
final
String
KEYWORD_TABLE
=
pg
.
getKeywordPrefix
()
+
"%s"
+
pg
.
getKeywordSuffix
();
public
static
final
String
KEYWORD_FIX
=
"%s."
+
pg
.
getKeywordPrefix
()
+
"%s"
+
pg
.
getKeywordSuffix
();
public
static
final
String
UNIX_TIMESTAMP
=
"floor(extract(epoch from(( %s - timestamp '1970-01-01 00:00:00')*1000))) "
;
public
static
final
String
DATE_FORMAT
=
"to_char(%s, %s)"
;
public
static
final
String
FROM_UNIXTIME
=
"to_timestamp(%s)"
;
public
static
final
String
TO_DATE
=
"to_date(%s,'%s')"
;
public
static
final
String
CAST
=
"CAST(%s AS %s)"
;
public
static
final
String
DEFAULT_DATE_FORMAT
=
"'YYYY-MM-DD HH24:MI:SS'"
;
public
static
final
String
DEFAULT_INT_FORMAT
=
"numeric(18,0)"
;
public
static
final
String
DEFAULT_FLOAT_FORMAT
=
"numeric(18,2)"
;
public
static
final
String
WHERE_VALUE_NULL
=
"(NULL,'')"
;
public
static
final
String
WHERE_VALUE_VALUE
=
"'%s'"
;
public
static
final
String
AGG_COUNT
=
"COUNT(*)"
;
public
static
final
String
AGG_FIELD
=
"%s(%s)"
;
public
static
final
String
WHERE_BETWEEN
=
"'%s' AND '%s'"
;
public
static
final
String
BRACKETS
=
"(%s)"
;
}
backend/src/main/java/io/dataease/provider/redshift/RedshiftQueryProvider.java
0 → 100644
浏览文件 @
308a0f93
差异被折叠。
点击展开。
backend/src/main/java/io/dataease/service/dataset/ExtractDataService.java
浏览文件 @
308a0f93
...
...
@@ -1105,13 +1105,11 @@ public class ExtractDataService {
}
catch
(
Exception
e
)
{
return
false
;
}
HttpGet
getMethod
=
new
HttpGet
(
"http://"
+
carte
+
":"
+
port
);
HttpClientManager
.
HttpClientBuilderFacade
clientBuilder
=
HttpClientManager
.
getInstance
().
createBuilder
();
clientBuilder
.
setConnectionTimeout
(
1
);
clientBuilder
.
setCredentials
(
user
,
passwd
);
CloseableHttpClient
httpClient
=
clientBuilder
.
build
();
try
{
try
(
CloseableHttpClient
httpClient
=
clientBuilder
.
build
()){
HttpResponse
httpResponse
=
httpClient
.
execute
(
getMethod
);
int
statusCode
=
httpResponse
.
getStatusLine
().
getStatusCode
();
if
(
statusCode
!=
-
1
&&
statusCode
<
400
)
{
...
...
drivers/redshift-jdbc42-2.1.0.1.jar
0 → 100644
浏览文件 @
308a0f93
File added
frontend/src/views/system/datasource/form.vue
浏览文件 @
308a0f93
...
...
@@ -159,6 +159,7 @@ export default {
{
name
:
'mariadb'
,
label
:
'MariaDB'
,
type
:
'jdbc'
,
extraParams
:
'characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true'
},
{
name
:
'ds_doris'
,
label
:
'Doris'
,
type
:
'jdbc'
,
extraParams
:
'characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true'
},
{
name
:
'ck'
,
label
:
'ClickHouse'
,
type
:
'jdbc'
,
extraParams
:
''
},
{
name
:
'redshift'
,
label
:
'AWS Redshift'
,
type
:
'jdbc'
},
{
name
:
'mongo'
,
label
:
'MongoDB'
,
type
:
'jdbc'
,
extraParams
:
''
}
],
schemas
:
[],
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论