Skip to content

Commit

Permalink
black reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
edurdevic committed Oct 24, 2023
1 parent 51cc2a1 commit 8b8c20d
Showing 1 changed file with 21 additions and 22 deletions.
43 changes: 21 additions & 22 deletions examples/iterate_over_table_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,21 @@

from discoverx.table_info import TableInfo


def my_function(table_info: TableInfo):

# TODO: Add your logic here
print(f"{table_info.catalog}.{table_info.schema}.{table_info.table} has {len(table_info.columns)} columns")

if table_info.tags:
print(f" - catalog_tags: {table_info.tags.catalog_tags}")
print(f" - schema_tags: {table_info.tags.schema_tags}")
print(f" - table_tags: {table_info.tags.table_tags}")
print(f" - column_tags: {table_info.tags.column_tags}")
# TODO: Add your logic here
print(f"{table_info.catalog}.{table_info.schema}.{table_info.table} has {len(table_info.columns)} columns")

if table_info.tags:
print(f" - catalog_tags: {table_info.tags.catalog_tags}")
print(f" - schema_tags: {table_info.tags.schema_tags}")
print(f" - table_tags: {table_info.tags.table_tags}")
print(f" - column_tags: {table_info.tags.column_tags}")

# The returned objects will be concatenated in the map result
return table_info

# The returned objects will be concatenated in the map result
return table_info


# COMMAND ----------

Expand All @@ -45,10 +46,10 @@ def my_function(table_info: TableInfo):

# COMMAND ----------

result = (dx
.from_tables(from_tables)
.with_concurrency(1) # You can increase the concurrency with this parameter
.map(my_function)
result = (
dx.from_tables(from_tables)
.with_concurrency(1) # You can increase the concurrency with this parameter
.map(my_function)
)

# COMMAND ----------
Expand All @@ -62,17 +63,15 @@ def my_function(table_info: TableInfo):

# COMMAND ----------

result = (dx
.from_tables(from_tables)
.with_concurrency(1) # You can increase the concurrency with this parameter
.with_tags() # This will ensure we add tag information to the table info
.map(my_function)
result = (
dx.from_tables(from_tables)
.with_concurrency(1) # You can increase the concurrency with this parameter
.with_tags() # This will ensure we add tag information to the table info
.map(my_function)
)

# COMMAND ----------

len(result)

# COMMAND ----------


0 comments on commit 8b8c20d

Please sign in to comment.