• 大小: 34KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-11
  • 语言: 数据库
  • 标签: PYQT5  SQLITE  Pyt  

资源简介

通过PYQT5做的一个桌面小工具,连接sqlite数据库,自定义表格展示数据,以及表格点击显示出详细数据,供大家参考。

资源截图

代码片段和文件信息

from PyQt5.Qt import *
from main_menue import Ui_man

from my_db import ado_mydadb





class main_me(QWidgetUi_man):

    que=ado_mydadb()

    def __init__(self parent=None):
        “““
        设置一些表格样式
        “““
        super(main_me self).__init__(parent)
        self.setupUi(self)
        self.show_data()

    @pyqtSlot(intint)
    def on_etl_job_list_cellClicked(self row column):
        print(“表格被点击了“)
        print(self.etl_job_list.currentRow())
        c_row = self.etl_job_list.currentRow()
        etl_job = self.etl_job_list.item(c_row 0).text()

        self.show_dept_data(etl_job)
    def show_dept_data(selfetl_job):

        sel_cnt = self.etl_job_list.selectedRanges()

        print(sel_cnt)
        if not sel_cnt:
            print(“未选中作业“)
        else :
            if self.dept_type_all.isChecked():
                print(“全部被选中“)
                updn_dep = ‘1‘
            elif self.dept_up.isChecked():
                print(“上游被选中“)
                updn_dep = ‘2‘
            elif self.dept_down.isChecked():
                print(“下游被选中“)
                updn_dep = ‘3‘

            if self.denpt_all.isChecked():
                print(“所有被选中“)
                dep = ‘1‘
            elif self.one_dept.isChecked():
                print(“一层依赖“)
                dep = ‘2‘
            elif self.two_dept.isChecked():
                print(“两层依赖“)
                dep = ‘3‘

            if updn_dep == ‘1‘ and dep == ‘1‘:
                pass
            elif updn_dep == ‘1‘ and dep == ‘2‘:
                dep_job_sql = “““
                select 
                    case
                         when t1.etl_job = ‘etl_job_code‘ then ‘上游‘
                        else ‘下游‘
                    end as dep_type
                    case
                         when t1.etl_job =  ‘etl_job_code‘ then t1.dependent_job
                        else t1.etl_job 
                    end as etl_job
                    case
                         when t1.etl_job = ‘etl_job_code‘ then t3.etl_job_nm
                        else t2.etl_job_nm
                    end as etl_job_nm                
                    t2.job_status
                from rdm_etl_job_dependent t1
                left join rdm_etl_job_ctrl t2
                        on t1.etl_job = t2.etl_job
                left join rdm_etl_job_ctrl t3
                       on t1.dependent_job = t3.etl_job
                where t1.etl_job =  ‘etl_job_code‘
                or dependent_job =  ‘etl_job_code‘
                order by 1
                “““
                new_etl_job_sql = dep_job_sql.replace(“etl_job_code“etl_job)
                print(new_etl_job_sql)

            elif updn_dep == ‘1‘ and dep == ‘3‘:
                pass
            elif updn_dep == ‘2‘ and dep == ‘1‘:
                pass
            elif updn_dep == ‘2‘ and dep == ‘2‘:
                pass
            e

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件     131072  2019-10-08 17:13  mydb.db

     文件      16617  2019-10-17 17:04  untitled.ui

     文件      12148  2019-10-09 16:26  main.py

     文件      15476  2019-10-17 17:06  main_menue.py

     文件       2276  2019-10-07 11:47  my_db.py

----------- ---------  ---------- -----  ----

               177589                    5


评论

共有 条评论