Icon

kn_​forum_​58667_​get_​data_​definition_​types_​bash

Try to replace NGS Bash node with a suggestion from carstenhaubold - KNIME forum 58667

Try to replace NGS Bash node with a suggestion from carstenhaubold - KNIME forum 58667

GoalRetreive all declared data types from with the KnimeGitHub Repository: https://github.com/knime/knime-corePurposeAutomatically fetch all Column Type DefintionsDefintions to i.e. declare them via a variable in theColumn Expression NodeCorresponding Forum Posthttps://forum.knime.com/t/column-expressions-guidance-dynamically-set-column-type/47003/3?u=mwiegand Possible Bug?All returned data types are of type string Try to replace NGS Bash node with a suggestion from carstenhaubold - KNIME forum 58667 import knime.scripting.io as knioimport subprocess as spimport pandas as pd# https://forum.knime.com/t/external-tool-issues-and-high-difficulty-to-use/58252/12?u=mlauber71# equivalent to the input fields of the NGS bash node:cmd = 'curl -LO https://github.com/knime/knime-core/archive/refs/heads/master.zip'working_dir = knio.flow_variables['context.workflow.temp.location']proc = sp.run(cmd.split(""), cwd=working_dir, capture_output=True)def get_lines_not_empty(stream): lines = stream.decode().splitlines() if len(lines) == 0: return [""] # because KNIME doesn't like a completely empty data frame else: return linesdf_stdout = pd.DataFrame({"StdOut": get_lines_not_empty(proc.stdout)})df_stderr = pd.DataFrame({"StdErr": get_lines_not_empty(proc.stderr)})knio.output_tables[0] = knio.Table.from_pandas(df_stdout)knio.output_tables[1] = knio.Table.from_pandas(df_stderr) curlKnime Masterform GitHubNode 11Node 14Node 15Node 16Node 17Keep 1st RowNode 20Node 21Sample DataNode 1601Set Array Indexfor Column ExpressionColumn Type Node 1626Node 1627Node 1628Node 1629cmd = 'grep -rin core.data.def' Python Script Extract ContextProperties List Files/Folders String to Path(Variable) Table Rowto Variable Decompress Files Row Filter Path to String Table Rowto Variable Test Data Generator Extract Table Spec Rule Engine Regex Extractor GroupBy Concatenate Delete Files/Folders(Table) Manually retreive all Data Typesfrom Column Expression Node Python Script GoalRetreive all declared data types from with the KnimeGitHub Repository: https://github.com/knime/knime-corePurposeAutomatically fetch all Column Type DefintionsDefintions to i.e. declare them via a variable in theColumn Expression NodeCorresponding Forum Posthttps://forum.knime.com/t/column-expressions-guidance-dynamically-set-column-type/47003/3?u=mwiegand Possible Bug?All returned data types are of type string Try to replace NGS Bash node with a suggestion from carstenhaubold - KNIME forum 58667 import knime.scripting.io as knioimport subprocess as spimport pandas as pd# https://forum.knime.com/t/external-tool-issues-and-high-difficulty-to-use/58252/12?u=mlauber71# equivalent to the input fields of the NGS bash node:cmd = 'curl -LO https://github.com/knime/knime-core/archive/refs/heads/master.zip'working_dir = knio.flow_variables['context.workflow.temp.location']proc = sp.run(cmd.split(""), cwd=working_dir, capture_output=True)def get_lines_not_empty(stream): lines = stream.decode().splitlines() if len(lines) == 0: return [""] # because KNIME doesn't like a completely empty data frame else: return linesdf_stdout = pd.DataFrame({"StdOut": get_lines_not_empty(proc.stdout)})df_stderr = pd.DataFrame({"StdErr": get_lines_not_empty(proc.stderr)})knio.output_tables[0] = knio.Table.from_pandas(df_stdout)knio.output_tables[1] = knio.Table.from_pandas(df_stderr) curlKnime Masterform GitHubNode 11Node 14Node 15Node 16Node 17Keep 1st RowNode 20Node 21Sample DataNode 1601Set Array Indexfor Column ExpressionColumn Type Node 1626Node 1627Node 1628Node 1629cmd = 'grep -rin core.data.def' Python Script Extract ContextProperties List Files/Folders String to Path(Variable) Table Rowto Variable Decompress Files Row Filter Path to String Table Rowto Variable Test Data Generator Extract Table Spec Rule Engine Regex Extractor GroupBy Concatenate Delete Files/Folders(Table) Manually retreive all Data Typesfrom Column Expression Node Python Script

Nodes

Extensions

Links