<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: how can I pass the df columns as a parameter in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-can-i-pass-the-df-columns-as-a-parameter/m-p/26469#M18508</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;df2.select([column_name]).write&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;OR&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;df2.select(column_name).write&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 20 Oct 2022 14:53:21 GMT</pubDate>
    <dc:creator>Hubert-Dudek</dc:creator>
    <dc:date>2022-10-20T14:53:21Z</dc:date>
    <item>
      <title>how can I pass the df columns as a parameter</title>
      <link>https://community.databricks.com/t5/data-engineering/how-can-i-pass-the-df-columns-as-a-parameter/m-p/26468#M18507</link>
      <description>&lt;P&gt;Im doing the self study and want pass df column name as a parameter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have defined the widget &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;column_name= dbutils.widgets.get('column_name')&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;which is executing succefuly ( giving me a column name)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then Im reading the df and do some transformation and after that I want to wrtie back to datalake. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;try:
    (df2[column_name].write
     .mode('append')
     .parquet(f'/mnt/bro/Default/{table_name}'))
except Exception as e:
    print(e)
    raise Exception(e)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;then, idea is that adf pipeline will loop through different files after.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but when i run the above code I get error&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;'DataFrame' object has no attribute 'column_name'&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; Im sorry if my explanation is not good enough, I just started learning. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2022 15:27:34 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-can-i-pass-the-df-columns-as-a-parameter/m-p/26468#M18507</guid>
      <dc:creator>g96g</dc:creator>
      <dc:date>2022-10-19T15:27:34Z</dc:date>
    </item>
    <item>
      <title>Re: how can I pass the df columns as a parameter</title>
      <link>https://community.databricks.com/t5/data-engineering/how-can-i-pass-the-df-columns-as-a-parameter/m-p/26469#M18508</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;df2.select([column_name]).write&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;OR&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;df2.select(column_name).write&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2022 14:53:21 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-can-i-pass-the-df-columns-as-a-parameter/m-p/26469#M18508</guid>
      <dc:creator>Hubert-Dudek</dc:creator>
      <dc:date>2022-10-20T14:53:21Z</dc:date>
    </item>
  </channel>
</rss>

