Azure Data Factory: Dataset Dynamic DB Table name not resolving in Data Wrangling Flow - azure-data-factory

I created a DataSet which points to a table in my database. The name of the table is set as dynamic content: #concat(dataset().db_prefix, '_Baseline_CIs'). This works when checking in the Dataset through 'Preview Data'. The table contents are shown.
BUT: When using the dataset in the Data Warngling Flow, the M-query fails with the following error:
Expression.Error: The key didn't match any rows in the table.
AdfDoc = Sql.Database("oedudigital.database.windows.net", "IntegratedEnvironments"),
InputTable = AdfDoc{[Schema = "dbo", Item = "undefined"]}[Data]
As you can see, the table name concatenation has returned 'undefined'. Is this a bug?
BR, Denis

If I understand it right you have the DataSet which is parameter , at least that was the case on my side . Under the AdFResouce you will see the dataset name . You will have to pass the table name as
AdfDoc{[Schema = "dbo", Item = "TableName"]}[Data]
and then it will bring in the records .

Related

is it possible to copy data from table to another based off if data in one table matches the data in the other table in a specific column

I have a table A with the following columns and data:
Tag_ = P-111
Description_ = Pump
HP_ = 100
RPM_ = 1,800
I have another table B with same columns:
Tag_ = P-111
Description_
HP_
RPM_
Is there a way when I enter data in the Tag_ column in Table B and there is matching data in the same Tag_ column in Table A that I can set up a trigger or automatic command that sends the data from the other columns in Table A to Table B?

How to set values for one column based on another?

How to set values for one column based on another?
Goal: When in the DB table the column Remote = table SO in the column
Thrunode -> Set in the table DB the column customer = table SO
DB = tbl_db_collecting
SO = tb_systemshc
sql:
UPDATE tbl_db_collecting SET
tbl_db_collecting.customer = tb_systemshc.environment
FROM tb_systemshc
WHERE tbl_db_collecting.lower(remote) = tb_systemshc.lower(thrunode)
output:
SQL Error [3F000]: ERROR: schema "tbl_db_collecting" does not exist
Is this what you are looking for?
update tbl_db_collecting
set customer = tb_systemshc.environment
from tb_systemshc
where lower(tbl_db_collecting.remote) = lower(tb_systemshc.thrunode);
When you write tbl_db_collecting.lower(remote), PostgreSQL parses that as if you are looking for a lower() function defined in schema tbl_db_collecting.

Adding values to a newly inserted column in an existing table in PostgreSQL 9.3

created a table named "collegetable":
create table collegetable (stid integer primary key not null,stname
varchar(50),department varchar(10),dateofjoin date);
provided values for each column:collegetable data
inserted a new column in it named "cgpa" and tried to add values for this column in one shot using the code:
WITH col(stid, cgpa) as
( VALUES((1121,8.01),
(1131,7.12),
(1141,9.86))
)
UPDATE collegetable as colldata
SET cgpa = col.cgpa
FROM col
WHERE colldata.stid = col.stid;
and got error :
ERROR:operator does not exist:integer=record
LINE9:where colldata.stid=col.stid;
HINT:No operator matches the given name and arguement type.you might need to add explicit type casts.
pls help in solving.thanks in advance.
The with clause only defines the names of the columns, not the data types:
with col (stid, cgpa) as (
...
)
update ...;
For details see the tutorial and the full reference

How do I find the table for an ItemType in IBM Content Manager 8.4

Given the item type name how do i find the underlying table on the IBM Content manager 8.4 Library Server database?
The database name is usually ICMNLSDB and the Scehma name is usually ICMADMIN
To find the underlying first run the below query against the ICMADMIN Schema substituting the $$ItemType$$ for your item type name
SELECT k2.keywordcode comptypeid, k2.keywordname comptypename
FROM icmstnlskeywords k1, icmstnlskeywords k2, icmstcompdefs ct
WHERE k1.keywordclass = 2
AND k1.keywordname = '$$ItemType$$'
AND k1.keywordcode = ct.itemtypeid
AND k2.keywordclass = 5
AND k2.keywordcode = ct.componenttypeid
AND k2.keywordname = '$$ItemType$$'
The COMPTYPEID can now be used to find your table the convention for the tables is the name:
ICMADMIN.ICMUTnnnnn001
Where the nnnnn is the COMPTYPEID from the previous query prefixed with leading zeros. This will then give the attributes and the ids required for generating the CMBItems. These details can be found on the IBM website by googleing the table names.
Example: Item type ICCFilesytem
Step 1: Get ComponentTypeId from icmstnlskeywords table
Query:
select * from icmstnlskeywords where keywordclass=5 and keywordname = ‘ICCFilesytem;
//Result 1055
Step 2: Form ICMUT(IBM Content Manager User Table) table name using
ComponentTypeId 1055
ICMUT01055001
where
ICMUT(Keyword)
01055(ComponentTypeId of 5 digit)
001(Segment Id by default 001)
Step 4: Get Documents in ICCFilesytem
Query:
Select * from ICMUT01055001;

Universal function module to retrieve SAP table data

What is the best way to access table data from a SAP system?
I tried it with it RFC_READ_TABLE, but this RFC returns the data in concatenated form within a single column and has a size restriction for row data.
Is there a better way to access SAP data in generic form without creating custom RFCs into the system?
I am searching for a standard RFC solution, not a custom script.
If I understand your question right, you want to read a table, but at time of programming, you don't know which table.
With Select * from (tablename)you can read with a dynamic table name.
The target field can be defined dynamic with create data.
An example (untested, currently I have no access to an SAP-system):
DATA: lv_tablename TYPE string,
ev_filelength TYPE i.
lv_tablename = 'mara'. "e.g. a parameter
DATA dref TYPE REF TO data.
CREATE DATA dref TYPE TABLE OF (lv_tablename).
FIELD-SYMBOLS: <wa> TYPE ANY TABLE.
ASSIGN dref->* to <wa>.
SELECT * FROM (lv_tablename) INTO TABLE <wa>. "Attention for test, may be large result
"<wa> is like a variable with type table mara
TYPES: BEGIN OF t_bseg,
*include structure bseg.
bukrs LIKE bseg-bukrs,
belnr LIKE bseg-belnr,
gjahr LIKE bseg-gjahr,
buzei LIKE bseg-buzei,
mwskz LIKE bseg-mwskz, "Tax code
umsks LIKE bseg-umsks, "Special G/L transaction type
prctr LIKE bseg-prctr, "Profit Centre
hkont LIKE bseg-hkont, "G/L account
xauto LIKE bseg-xauto,
koart LIKE bseg-koart,
dmbtr LIKE bseg-dmbtr,
mwart LIKE bseg-mwart,
hwbas LIKE bseg-hwbas,
aufnr LIKE bseg-aufnr,
projk LIKE bseg-projk,
shkzg LIKE bseg-shkzg,
kokrs LIKE bseg-kokrs,
END OF t_bseg.
DATA: it_bseg TYPE STANDARD TABLE OF t_bseg INITIAL SIZE 0,
wa_bseg TYPE t_bseg.
DATA: it_ekko TYPE STANDARD TABLE OF ekko.
*Select all fields of a SAP database table into in itab
SELECT *
FROM ekko
INTO TABLE it_ekko.
Try this snippet of RFC_READ_TABLE to get data in structured form:
DATA: oref TYPE REF TO cx_root,
text TYPE string,
obj_data TYPE REF TO data.
lt_options TYPE TABLE OF rfc_db_opt,
ls_option TYPE rfc_db_opt,
lt_fields TYPE TABLE OF rfc_db_fld,
ls_field TYPE rfc_db_fld,
lt_entries TYPE STANDARD TABLE OF tab512.
FIELD-SYMBOLS: <fs_tab> TYPE STANDARD TABLE.
TRY.
ls_option-text = `some query`.
APPEND ls_option TO lt_options.
ls_field-fieldname = 'PARTNER'.
APPEND ls_field TO lt_fields.
ls_field-fieldname = 'TYPE'.
APPEND ls_field TO lt_fields.
ls_field-fieldname = 'BU_GROUP'.
APPEND ls_field TO lt_fields.
ls_field-fieldname = 'BU_SORT1'.
APPEND ls_field TO lt_fields.
ls_field-fieldname = 'TITLE'.
APPEND ls_field TO lt_fields.
CALL FUNCTION 'RFC_READ_TABLE' DESTINATION dest
EXPORTING
query_table = 'BUT000'
TABLES
options = lt_options
fields = lt_fields
data = lt_entries.
CATCH cx_root INTO oref.
text = oref->get_text( ).
MESSAGE text TYPE 'E'.
ENDTRY.
IF lt_entries IS NOT INITIAL.
CREATE DATA obj_data TYPE TABLE OF but000.
ASSIGN obj_data->* TO <fs_tab>.
CREATE DATA obj_data TYPE but000.
ASSIGN obj_data->* TO FIELD-SYMBOL(<fs_line>).
LOOP AT lt_entries ASSIGNING FIELD-SYMBOL(<wa_data>).
LOOP AT lt_fields ASSIGNING FIELD-SYMBOL(<fs_fld>).
ASSIGN COMPONENT <fs_fld>-fieldname OF STRUCTURE <fs_line> TO FIELD-SYMBOL(<lv_field>).
IF <lv_field> IS ASSIGNED AND sy-subrc IS INITIAL.
<lv_field> = <wa_data>-wa+<fs_fld>-offset(<fs_fld>-length).
ENDIF.
APPEND <fs_line> TO <fs_tab>.
ENDLOOP.
ENDLOOP.
ENDIF.
IF <fs_tab> IS NOT INITIAL.
"Bingo!
ENDIF.