SAP BW:QUERY数据结果写入ADSO

2024-08-23 18:04
文章标签 数据 写入 sap query adso bw

本文主要是介绍SAP BW:QUERY数据结果写入ADSO,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

作者 idan lian  如需转载备注出处

如果对你有帮助,请点赞收藏~~~

需求背景

客户基于QUERY进行报表展示,现需迁移到永洪报表平台,query中的变量参数,公式等无法直接生成视图,query相对复杂,不想直接在视图复现,想办法取出query的执行结果,落地存入ADSO。供报表平台使用

解决方案

通过函数执行query结果,并生成动态内表,将数据写入ADSO中

落地query如下

创建ADSO如下

1.创建函数:Z_GET_BW_QUERY_DATA

FUNCTION Z_GET_BW_QUERY_DATA.
*"----------------------------------------------------------------------
*"*"本地接口:
*"  IMPORTING
*"     REFERENCE(I_INFOPROVIDER) TYPE  RSINFOPROV
*"     REFERENCE(I_QUERY) TYPE  RSZCOMPID
*"     REFERENCE(I_VIEW_ID) TYPE  RSZVIEWID
*"     REFERENCE(I_T_PARAMETER) TYPE  RRXW3TQUERY
*"  EXPORTING
*"     REFERENCE(DY_TABLE) TYPE REF TO  DATA
*"----------------------------------------------------------------------*Global data declarationsDATA wa_parameter TYPE w3query.DATA i_parameter TYPE TABLE OF w3query .DATA wa_query_result TYPE rrws_s_cell .DATA query_result TYPE TABLE OF rrws_s_cell .DATA wa_axis_result TYPE LINE OF rrws_thx_axis_data .DATA axis_result TYPE  rrws_thx_axis_data .DATA wa_tx_set_1 TYPE LINE OF rrws_tx_set.DATA tx_set_1 TYPE rrws_tx_set.DATA wa_tx_set_0 TYPE LINE OF rrws_tx_set.DATA tx_set_0 TYPE rrws_tx_set.*解决动态内表最多创建36次的问题TYPE-POOLS:abap.DATA:ls_components TYPE abap_componentdescr,lt_components TYPE abap_component_tab,lo_elemt_type TYPE REF TO cl_abap_datadescr,lo_type       TYPE REF TO cl_abap_typedescr,z_stu         TYPE REF TO  cl_abap_structdescr,z_tab         TYPE REF TO  cl_abap_tabledescr,lr_dyn_wa     TYPE REF TO data.
*       DYN_TABLE  TYPE REF TO DATA.TYPES: BEGIN OF dzgx,fieldname     LIKE lvc_s_fcat-fieldname,fieldnamec(6) TYPE c,END OF dzgx.DATA: wa_mcdz TYPE dzgx,it_mcdz TYPE HASHED TABLE OF dzgx WITH UNIQUE KEY fieldname.DATA: k_num         TYPE i,c_num         TYPE i,lines_num     TYPE i,c1_num        TYPE i,it_structure  TYPE lvc_t_fcat,wa_structure  TYPE lvc_s_fcat,pos           TYPE i,line_ps       TYPE i,index         TYPE i,index1        TYPE i,field_name(6) TYPE c,posc(6)       TYPE c,pos1          TYPE i,lv_string     TYPE string.DATA:wa_new_line TYPE REF TO data.FIELD-SYMBOLS:<dyn_table> TYPE STANDARD TABLE,<dyn_wa>    TYPE any,<dyn_field> TYPE any.DATA:dy_line  TYPE REF TO data.CALL FUNCTION 'RRW3_GET_QUERY_VIEW_DATA'EXPORTINGi_infoprovider          = i_infoprovideri_query                 = i_queryi_view_id               = i_view_idi_t_parameter           = i_t_parameterIMPORTING
*     E_AXIS_INFO             =e_cell_data             = query_resulte_axis_data             = axis_result
*     E_TXT_SYMBOLS           =EXCEPTIONSno_applicable_data      = 1invalid_variable_values = 2no_authority            = 3abort                   = 4invalid_input           = 5invalid_view            = 6OTHERS                  = 7.IF sy-subrc <> 0.IF query_result IS INITIAL AND axis_result IS INITIAL.RETURN.ELSE.MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgnoWITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.ENDIF.ENDIF.pos = 1.READ TABLE axis_result INTO wa_axis_result WITH KEY axis = '001'.tx_set_1[] = wa_axis_result-set[] .DELETE tx_set_1 WHERE tuple_ordinal <> '000000'.DESCRIBE TABLE tx_set_1 LINES c_num.LOOP AT tx_set_1 INTO wa_tx_set_1.posc = pos.CONDENSE posc.CONCATENATE 'C' posc INTO field_name.wa_structure-fieldname = field_name.wa_structure-col_pos = pos.         " 表数wa_structure-inttype = 'C'.        " 数据类型wa_structure-intlen  = 30.         " 长度wa_mcdz-fieldname = wa_tx_set_1-chanm.wa_mcdz-fieldnamec = field_name.INSERT  wa_mcdz INTO TABLE it_mcdz.pos = pos + 1.APPEND wa_structure TO it_structure.ENDLOOP.READ TABLE axis_result INTO wa_axis_result WITH KEY axis = '000'.DESCRIBE TABLE wa_axis_result-set LINES k_num.tx_set_0[] = wa_axis_result-set[].pos1 = 1.LOOP AT tx_set_0 INTO wa_tx_set_0..posc = pos1.CONDENSE posc.CONCATENATE 'V' posc INTO field_name.wa_structure-fieldname = field_name.wa_structure-col_pos = pos.         " 表数wa_structure-inttype = 'C'.        " 数据类型wa_structure-intlen  = 30.         " 长度pos = pos + 1.pos1 = pos1 + 1.APPEND wa_structure TO it_structure.ENDLOOP.*  连续取36次 创建36次动态内表 就会dump
*  CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
*    EXPORTING
*      IT_FIELDCATALOG = IT_STRUCTURE
*    IMPORTING
*      EP_TABLE        = DY_TABLE.LOOP AT   it_structure INTO wa_structure .ls_components-name  =   wa_structure-fieldname.lv_string = '/BIC/AZT_MMD012-BWAPPLNM'.”替换成现有系统长一点的数据库表字段就行CALL METHOD cl_abap_datadescr=>describe_by_nameEXPORTINGp_name         = lv_stringRECEIVINGp_descr_ref    = lo_typeEXCEPTIONStype_not_found = 1OTHERS         = 2.ls_components-type ?=  lo_type.APPEND   ls_components TO  lt_components.ENDLOOP.CALL METHOD cl_abap_structdescr=>createEXPORTINGp_components = lt_componentsRECEIVINGp_result     = z_stu.CALL METHOD cl_abap_tabledescr=>createEXPORTINGp_line_type = z_stuRECEIVINGp_result    = z_tab." 参照动态结构类型和动态内表类型创建内表与工作区CREATE DATA lr_dyn_wa    TYPE HANDLE z_stu.CREATE DATA dy_table TYPE HANDLE z_tab." 指定内表与工作区到字段符号ASSIGN lr_dyn_wa->*    TO <dyn_wa>.ASSIGN dy_table->* TO <dyn_table>.READ TABLE axis_result INTO wa_axis_result WITH KEY axis = '001'.tx_set_1[] = wa_axis_result-set[] .DESCRIBE TABLE tx_set_1 LINES c1_num.lines_num = c1_num / c_num.line_ps = 1.WHILE line_ps <= lines_num.index = c_num * ( line_ps - 1 ) + 1.DO  c_num TIMES.pos = 1.WHILE pos <= c_num.index1 = index + pos - 1.READ TABLE tx_set_1 INTO wa_tx_set_1 INDEX index1 .posc = pos.CONDENSE posc.CONCATENATE 'C' posc INTO field_name.READ TABLE it_mcdz INTO wa_mcdz WITH  KEY fieldname = wa_tx_set_1-chanm.wa_structure-fieldname = wa_mcdz-fieldnamec.ASSIGN COMPONENT wa_structure-fieldname OF STRUCTURE <dyn_wa> TO <dyn_field>.
*之前取文本,改成取指标
*        IF wa_tx_set_1-caption = ''.
*          <dyn_field> = wa_tx_set_1-chavl.
*        ELSE.
*          <dyn_field> = wa_tx_set_1-caption.
*        ENDIF.<dyn_field> = wa_tx_set_1-chavl.pos = pos + 1.ENDWHILE.ENDDO.index = k_num * ( line_ps - 1 ) + 1.DO  k_num TIMES.pos = 1.WHILE pos <= k_num.READ TABLE tx_set_0 INTO wa_tx_set_0 INDEX pos .posc = pos.CONDENSE posc.CONCATENATE 'V' posc INTO field_name.wa_structure-fieldname = field_name.ASSIGN COMPONENT wa_structure-fieldname OF STRUCTURE <dyn_wa> TO <dyn_field>.index1 = index + pos - 1.READ TABLE query_result INTO wa_query_result INDEX index1 .
*        <DYN_FIELD> = WA_QUERY_RESULT-VALUE.<dyn_field> = wa_query_result-formatted_value.
*改成取带单位的单元格数据pos = pos + 1.ENDWHILE.ENDDO.APPEND <dyn_wa> TO <dyn_table>.CLEAR <dyn_wa>.line_ps = line_ps + 1.ENDWHILE.ENDFUNCTION.

2.基于函数创建程序 Z_GET_ZDEMO

*&---------------------------------------------------------------------*
*& Report Z_GET_ZDEMO
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT Z_GET_ZDEMO.
TABLES:/BIC/AZTDEMO2.*PARAMETER:z_fsr_f TYPE /bic/azfiglc046-fiscper OBLIGATORY .
*PARAMETER:z_fsr_t   TYPE /bic/azfiglc046-fiscper  .
*SELECT-OPTIONS: z_comp FOR /bic/azfiglc046-/bic/zcomp_cod.*根据query生成的动态结构定义,维度为C,指标为V,有多少条创建多少个
TYPES:BEGIN OF line,c1(100) TYPE c,c2(100) TYPE c,c3(100) TYPE c,c4(100) TYPE c,c5(100) TYPE c,c6(100) TYPE c,c7(100) TYPE c,c8(100) TYPE c,c9(100) TYPE c,v1(30)  TYPE c,v2(30)  TYPE c,v3(30)  TYPE c,v4(30)  TYPE c,v5(30)  TYPE c,v6(30)  TYPE c,END   OF line.DATA:wa_line      TYPE line,lt_dso       TYPE TABLE OF /BIC/AZTDEMO2,ls_dso       TYPE /BIC/AZTDEMO2,wa_parameter TYPE w3query,i_parameter  TYPE TABLE OF w3query,dyn_table    TYPE REF TO data.FIELD-SYMBOLS:<dyn_table> TYPE STANDARD TABLE,<dyn_wa>    TYPE any,<dyn_field> TYPE any.DATA:e_lines_inserted TYPE int4,et_msg           TYPE rs_t_msg,e_upd_req_tsn    TYPE rspm_request_tsn,et_act_req_tsn   TYPE rsdso_t_tsn.INITIALIZATION.*  SELECT
* SINGLE
*   zdate INTO @DATA(lv_zdate)
* FROM  ztcon_bpc02 .
*
*  z_fsr_f = lv_zdate+0(4) && '001' .
*
*  z_fsr_t =  lv_zdate+0(4) && '0' && lv_zdate+4(2).*----------------------------------------------------------------------*
*           数据处理过程                                               *
*----------------------------------------------------------------------*START-OF-SELECTION.*要先将要更新的模型内的公司库存数据 R掉  在插入新的,在where后面加入期间限制,即可按月刷新ASDO.。SELECTPLANT,COORDER,MATERIAL,/BIC/ZCALMONTH,'R' AS RECORDMODE,/BIC/ZCALYEAR,COMP_CODE,BASE_UOM,/BIC/ZCAMONTH2,LOC_CURRCY,/BIC/ZMENGE1,CPQUABU,/BIC/ZAHGPSL,/BIC/ZABHGSL,/BIC/ZACZ,/BIC/ZACZHFGINTO TABLE @DATA(lt_r)FROM  /BIC/AZTDEMO2.*  SELECT
*        DISTINCT
*       /bic/zcomp_cod
*       INTO TABLE @DATA(lt_comp)
*     FROM  /bic/azfiglc046
*       WHERE /bic/zcomp_cod IN @z_comp
*         AND  /bic/zcomp_cod <> ''
*       ORDER BY /bic/zcomp_cod.*  IF z_comp IS INITIAL.
*    CLEAR lt_comp.
*    INSERT INITIAL LINE INTO lt_comp INDEX 1.
*
*  ENDIF.*  LOOP AT lt_comp INTO DATA(ls_comp).
*
*    CLEAR : i_parameter.
*
*query input变量赋值
*    wa_parameter-name = 'VAR_NAME_1'.
*    wa_parameter-value = 'ZCOMP'.
*    APPEND wa_parameter TO i_parameter.
*
*    wa_parameter-name = 'VAR_VALUE_EXT_1'.
*    wa_parameter-value =  ls_comp-/bic/zcomp_cod .
*    APPEND wa_parameter TO i_parameter.
*
*    wa_parameter-name = 'VAR_NAME_2'.
*    wa_parameter-value = 'Z1FISPER04'.
*    APPEND wa_parameter TO i_parameter.
*
*    wa_parameter-name =   'VAR_VALUE_LOW_EXT_2'.
*    wa_parameter-value =  z_fsr_f.
*    APPEND wa_parameter TO i_parameter.
*
*    wa_parameter-name =   'VAR_VALUE_HIGH_EXT_2'.
*    wa_parameter-value = z_fsr_t.
*
*
*    APPEND wa_parameter TO i_parameter.*   wa_parameter-name = 'VAR_NAME_1'."ZCVC_ZCALMONTH_019*   wa_parameter-value = 'ZCVC_ZCALMONTH_019'.*   APPEND wa_parameter TO i_parameter.wa_parameter-name = 'VAR_VALUE_EXT_1'."ZCVC_ZCALMONTH_019wa_parameter-value = '202406'.APPEND wa_parameter TO i_parameter.wa_parameter-name = 'VAR_NAME_2'."ZCVC_ZCALMONTH_019wa_parameter-value = 'ZCVC_ZCATEGORY_001'.APPEND wa_parameter TO i_parameter.
*wa_parameter-name = 'VAR_VALUE_EXT_2'."版本(单值出口,以输入月份所在月的版本)wa_parameter-value =  'V01' .APPEND wa_parameter TO i_parameter.
*wa_parameter-name = 'VAR_NAME_3'."数据来源(单值,可选出口)wa_parameter-value = 'ZCVC_ZASJLY_001'.APPEND wa_parameter TO i_parameter.wa_parameter-name = 'VAR_VALUE_EXT_3'."数据来源(单值,可选出口)wa_parameter-value = 'LOAD'.APPEND wa_parameter TO i_parameter.call function 'Z_GET_BW_QUERY_DATA'EXPORTINGi_infoprovider = 'ZTDEMO'“”这里是信息对象i_query        = 'ZTEST1'“这里是query”I_VIEW_ID      = ''i_t_parameter  = i_parameter
*       DESTINATION    =IMPORTINGdy_table       = dyn_table.*    IF dyn_table IS INITIAL.
*      CONTINUE.
*    ENDIF.ASSIGN dyn_table->* TO <dyn_table>.*2、将BW查询结果集写入直接更新DSOLOOP AT <dyn_table> ASSIGNING <dyn_wa>.MOVE-CORRESPONDING <dyn_wa>  TO wa_line.
*      ls_dso-z_fiscper_from = z_fsr_f.
*      ls_dso-z_fiscper_to   = z_fsr_t.
*      ls_dso-/bic/zcomp_cod = wa_line-c1.*      ENDCASE.
*     去除单位,逗号等DATA:LV_VN TYPE CHAR10,LV_I TYPE I.FIELD-SYMBOLS:<F1>,<F2>.ASSIGN wa_line TO <F1>.
"动态处理V1到V140,去除单位及逗号
CLEAR LV_I.
DO 140 TIMES.
LV_I = LV_I + 1.
LV_VN = 'V' && LV_I.
ASSIGN COMPONENT LV_VN OF STRUCTURE <F1> TO <F2>.
“如果query已经无量纲公式处理,此处无单位,去除逗号即可”
REPLACE ALL OCCURRENCES OF  ','   IN  <F2>  WITH  ``.
ENDDO.ls_dso-LOC_CURRCY  = wa_line-c1.ls_dso-/BIC/ZCALYEAR = wa_line-c2.ls_dso-/BIC/ZCALMONTH = wa_line-c3.ls_dso-/BIC/ZCAMONTH2 = wa_line-c4.ls_dso-COMP_CODE  = wa_line-c5.ls_dso-BASE_UOM  = wa_line-c6.ls_dso-PLANT  = wa_line-c7.ls_dso-COORDER  = wa_line-c8.ls_dso-MATERIAL  = wa_line-c9.ls_dso-/BIC/ZMENGE1  = wa_line-v1.ls_dso-CPQUABU = wa_line-v2.ls_dso-/BIC/ZAHGPSL = wa_line-v3.ls_dso-/BIC/ZABHGSL  = wa_line-v4.ls_dso-/BIC/ZACZ  = wa_line-v5.ls_dso-/BIC/ZACZHFG  = wa_line-v6.APPEND ls_dso TO lt_dso.CLEAR ls_dso.ENDLOOP.CLEAR: <dyn_table>.
*  ENDLOOP.*先将R掉的请求号 添加到模型内CALL FUNCTION 'RSDSO_WRITE_API'EXPORTINGi_adsonm            = 'ZTDEMO'
*     I_ALLOW_NEW_SIDS    = RS_C_TRUE
*     I_ACTIVATE_DATA     = RS_C_TRUE   "激活
*     IT_AGGREGATION      = LT_AGGREGATIONit_data             = lt_rIMPORTINGe_lines_inserted    = e_lines_insertedet_msg              = et_msge_upd_req_tsn       = e_upd_req_tsnet_act_req_tsn      = et_act_req_tsnEXCEPTIONSwrite_failed        = 1activation_failed   = 2datastore_not_found = 3OTHERS              = 4.CASE sy-subrc.
*          WHEN 0.
*            MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4 RAISING CHAIN_FAILED.WHEN 1.MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 RAISING write_failed.WHEN 2.MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 RAISING activation_failed.WHEN 3.MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 RAISING datastore_not_found.ENDCASE.*再将更新的数据 添加到请求内CALL FUNCTION 'RSDSO_WRITE_API'EXPORTINGi_adsonm            = 'ZTDEMO'
*     I_ALLOW_NEW_SIDS    = RS_C_TRUEI_ACTIVATE_DATA     = RS_C_TRUE   "激活
*     IT_AGGREGATION      = LT_AGGREGATIONit_data             = lt_dsoIMPORTINGe_lines_inserted    = e_lines_insertedet_msg              = et_msge_upd_req_tsn       = e_upd_req_tsnet_act_req_tsn      = et_act_req_tsnEXCEPTIONSwrite_failed        = 1activation_failed   = 2datastore_not_found = 3OTHERS              = 4.CASE sy-subrc.
*          WHEN 0.
*            MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4 RAISING CHAIN_FAILED.WHEN 1.MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 RAISING write_failed.WHEN 2.MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 RAISING activation_failed.WHEN 3.MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 RAISING datastore_not_found.ENDCASE.*Selection texts
*----------------------------------------------------------
* Z_COMP         公司代码(不输入公司代码,将更新所有公司)
* Z_FSR_F         会计期间始
* Z_FSR_T         会计期间止

3.注意点

注意点1

query中指标必须指标放在上面,维度放在下面,把结果行拿掉,佛则赋值会出现问题

注意点2

动态内表的生成顺序和query的顺序是一致的,后面如果改query字段顺序,就会有问题,需要改相应的赋值逻辑。

注意点3

获取的query数据默认是char类型,如果没有在query处理带单位的金额,会带单位,需要出处理

注意点4

传参格式比较特殊,注意写法,不同的参数有不同的NAME格式

Characteristic Value Variables

Parameter variables or variables for several single values are predefined as follows:

Parameter

Description

VAR_NAME_I

Technical name of the variables

VAR_VALUE_EXT_I

Attribute value in external display

Key for characteristic value in external display

Interval variables are predefined as in the following:

Parameter

Description

VAR_NAME_I

Technical name of the variables

VAR_VALUE_LOW_EXT_I

“From” characteristic value in external display

Key for characteristic value in external display

VAR_VALUE_HIGH_EXT_I

“To” characteristic value in external display

Key for characteristic value in external display

Selection option variables are predefined as in the following:

parameter

Description

VAR_NAME_I

Technical name of the variables

VAR_OPERATOR_I

An operator

'EQ' = Individual value

'BT' = Interval

'LT' = Less than

'LE' = Less than or equal to

'GT' = Greater than

'GE' = Greater than or equal to

VAR_VALUE_LOW_EXT_I

“From” characteristic value in external display

Key for characteristic value in external display

VAR_VALUE_HIGH_EXT_I

“To” characteristic value in external display

Key for characteristic value in external display

This value must only be specified with VAR_OPERATOR='BT'.

VAR_SIGN_I

Row properties

'I' found values are added,

 'E' found values are removed.

Variables for precalculated value sets are preassigned as follows:

Parameter

Description

VAR_NAME_I

Technical name of the variables

VAR_VALUE_EXT_I

Name of value set

Variables for Single Hierarchy Nodes or Variables for Several Hierarchy Nodes

Parameter

Description

VAR_NAME_I

Technical name of the variables

VAR_VALUE_EXT_I

Node key in external display

Key for hierarchy node

VAR_NODE_IOBJNM_I

Node characteristic name

With characteristic nodes and text nodes, you have to specify the characteristic name (0HIER_NODE).

Hierarchy, Formula, and Text Variables

Parameter

Description

VAR_NAME_I

Technical name of the variables

VAR_VALUE_EXT_I

Hierarchy name, formula value, text

这篇关于SAP BW:QUERY数据结果写入ADSO的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1100107

相关文章

大模型研发全揭秘:客服工单数据标注的完整攻略

在人工智能(AI)领域,数据标注是模型训练过程中至关重要的一步。无论你是新手还是有经验的从业者,掌握数据标注的技术细节和常见问题的解决方案都能为你的AI项目增添不少价值。在电信运营商的客服系统中,工单数据是客户问题和解决方案的重要记录。通过对这些工单数据进行有效标注,不仅能够帮助提升客服自动化系统的智能化水平,还能优化客户服务流程,提高客户满意度。本文将详细介绍如何在电信运营商客服工单的背景下进行

基于MySQL Binlog的Elasticsearch数据同步实践

一、为什么要做 随着马蜂窝的逐渐发展,我们的业务数据越来越多,单纯使用 MySQL 已经不能满足我们的数据查询需求,例如对于商品、订单等数据的多维度检索。 使用 Elasticsearch 存储业务数据可以很好的解决我们业务中的搜索需求。而数据进行异构存储后,随之而来的就是数据同步的问题。 二、现有方法及问题 对于数据同步,我们目前的解决方案是建立数据中间表。把需要检索的业务数据,统一放到一张M

关于数据埋点,你需要了解这些基本知识

产品汪每天都在和数据打交道,你知道数据来自哪里吗? 移动app端内的用户行为数据大多来自埋点,了解一些埋点知识,能和数据分析师、技术侃大山,参与到前期的数据采集,更重要是让最终的埋点数据能为我所用,否则可怜巴巴等上几个月是常有的事。   埋点类型 根据埋点方式,可以区分为: 手动埋点半自动埋点全自动埋点 秉承“任何事物都有两面性”的道理:自动程度高的,能解决通用统计,便于统一化管理,但个性化定

使用SecondaryNameNode恢复NameNode的数据

1)需求: NameNode进程挂了并且存储的数据也丢失了,如何恢复NameNode 此种方式恢复的数据可能存在小部分数据的丢失。 2)故障模拟 (1)kill -9 NameNode进程 [lytfly@hadoop102 current]$ kill -9 19886 (2)删除NameNode存储的数据(/opt/module/hadoop-3.1.4/data/tmp/dfs/na

异构存储(冷热数据分离)

异构存储主要解决不同的数据,存储在不同类型的硬盘中,达到最佳性能的问题。 异构存储Shell操作 (1)查看当前有哪些存储策略可以用 [lytfly@hadoop102 hadoop-3.1.4]$ hdfs storagepolicies -listPolicies (2)为指定路径(数据存储目录)设置指定的存储策略 hdfs storagepolicies -setStoragePo

Hadoop集群数据均衡之磁盘间数据均衡

生产环境,由于硬盘空间不足,往往需要增加一块硬盘。刚加载的硬盘没有数据时,可以执行磁盘数据均衡命令。(Hadoop3.x新特性) plan后面带的节点的名字必须是已经存在的,并且是需要均衡的节点。 如果节点不存在,会报如下错误: 如果节点只有一个硬盘的话,不会创建均衡计划: (1)生成均衡计划 hdfs diskbalancer -plan hadoop102 (2)执行均衡计划 hd

【Prometheus】PromQL向量匹配实现不同标签的向量数据进行运算

✨✨ 欢迎大家来到景天科技苑✨✨ 🎈🎈 养成好习惯,先赞后看哦~🎈🎈 🏆 作者简介:景天科技苑 🏆《头衔》:大厂架构师,华为云开发者社区专家博主,阿里云开发者社区专家博主,CSDN全栈领域优质创作者,掘金优秀博主,51CTO博客专家等。 🏆《博客》:Python全栈,前后端开发,小程序开发,人工智能,js逆向,App逆向,网络系统安全,数据分析,Django,fastapi

烟火目标检测数据集 7800张 烟火检测 带标注 voc yolo

一个包含7800张带标注图像的数据集,专门用于烟火目标检测,是一个非常有价值的资源,尤其对于那些致力于公共安全、事件管理和烟花表演监控等领域的人士而言。下面是对此数据集的一个详细介绍: 数据集名称:烟火目标检测数据集 数据集规模: 图片数量:7800张类别:主要包含烟火类目标,可能还包括其他相关类别,如烟火发射装置、背景等。格式:图像文件通常为JPEG或PNG格式;标注文件可能为X

pandas数据过滤

Pandas 数据过滤方法 Pandas 提供了多种方法来过滤数据,可以根据不同的条件进行筛选。以下是一些常见的 Pandas 数据过滤方法,结合实例进行讲解,希望能帮你快速理解。 1. 基于条件筛选行 可以使用布尔索引来根据条件过滤行。 import pandas as pd# 创建示例数据data = {'Name': ['Alice', 'Bob', 'Charlie', 'Dav

SWAP作物生长模型安装教程、数据制备、敏感性分析、气候变化影响、R模型敏感性分析与贝叶斯优化、Fortran源代码分析、气候数据降尺度与变化影响分析

查看原文>>>全流程SWAP农业模型数据制备、敏感性分析及气候变化影响实践技术应用 SWAP模型是由荷兰瓦赫宁根大学开发的先进农作物模型,它综合考虑了土壤-水分-大气以及植被间的相互作用;是一种描述作物生长过程的一种机理性作物生长模型。它不但运用Richard方程,使其能够精确的模拟土壤中水分的运动,而且耦合了WOFOST作物模型使作物的生长描述更为科学。 本文让更多的科研人员和农业工作者