-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
新增oracle查询 #175
新增oracle查询 #175
Conversation
需要rebase一下。 |
不知道 oracle 能不能把schema 和table 混起来考虑, 这样如果是两层的结构, 可以在现有的结构中混用。 我看yyukai的代码的意思是schema下面还有table,然后才是字段之类的 |
oracle其实不用处理database,在oracle中只有一个database,并且能通过创建user来创建schema,只需要在get_all_databases方法中返回schemas的信息,前端查询和权限申请以及校验规则就完全不用改,可以直接复用 pgsql则可以有多个database,并且不同database下的schema可以同名,所以必须要区分database和schema |
我有一个实现的建议: 新创建两个方法,
现有的 这样做的原因是统一engine的各种方法, 在工单和查询层面统一调用的方法,这样对后端的代码修改会非常小。 前端可以对不同类型数据库显示不同的名字。 |
pg有三级db->schema->tb,其实mssql也是类似吧 |
我目前 做了一个比较简单的处理, 直接把 oracle的模式 对标 mysql的数据库 来处理, 目前自己测试 在线查询,已经可以用了, 上线审核我用只读账号 测试 也能走完整个流程了, 看了上面 考虑的好多~!~,我想的简单了, |
@yzypals 你的方案也是很好的,redis和sql server采用的就是这样的方案,但是实际上是schema ,后端却是db,可能会有一些误解,正在思考如何解决问题 |
Codecov Report
@@ Coverage Diff @@
## master #175 +/- ##
=========================================
- Coverage 74.06% 73.17% -0.9%
=========================================
Files 62 63 +1
Lines 6810 6964 +154
=========================================
+ Hits 5044 5096 +52
- Misses 1766 1868 +102
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这些点我来调整吧
sql/admin.py
Outdated
@@ -58,7 +58,8 @@ class InstanceTagRelationsAdmin(admin.ModelAdmin): | |||
# 实例管理 | |||
@admin.register(Instance) | |||
class InstanceAdmin(admin.ModelAdmin): | |||
list_display = ('id', 'instance_name', 'db_type', 'type', 'host', 'port', 'user', 'create_time') | |||
list_display = ('id', 'instance_name', 'db_type', 'type', 'host', 'port', 'user', 'password', 'service_name', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
password本来就是加密的,不建议在列表展示
@@ -154,6 +154,19 @@ def query_masking(self, db_name=None, sql='', resultset=None): | |||
filtered_result = resultset | |||
return filtered_result | |||
|
|||
def execute_check(self, db_name=None, sql=''): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mssql的上线功能?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
准备做了, 我司DBA给了我一个备份方案
@@ -19,6 +19,7 @@ | |||
class="selectpicker show-tick form-control bs-select-hidden" | |||
data-live-search="true" | |||
data-placeholder="请选择实例:" required> | |||
// TODO 实例中的筛选可以在python代码中, 使用filter实现, 这种实现可能有效率问题。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
确实会有效率问题
src/init_sql/v1.5.0_v1.5.1.sql
Outdated
COMMENT 'Oracle Service name' | ||
AFTER password; | ||
|
||
alter table query_privileges_apply add `schema_list` longtext NOT NULL after db_list; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
后面三个语句可以删除了,然后直接补充在v1.5.3_v1.5.4.sql后面
2. oracle 权限申请 3. 数据库变更执行 v1.5.0_v1.5.1.sql
* 回滚前端的修改 * query 的参数统一为 db_name TODO : * 底层单元测试 * 前端验证
#144
#174
@yyukai