Skip to content

Instantly share code, notes, and snippets.

@RaMSFT
Last active June 20, 2022 10:57
Show Gist options
  • Select an option

  • Save RaMSFT/8d6c1fc54a7d8fd4abdc638fd79b42c2 to your computer and use it in GitHub Desktop.

Select an option

Save RaMSFT/8d6c1fc54a7d8fd4abdc638fd79b42c2 to your computer and use it in GitHub Desktop.
import time
table_list = ['customers','orders','adress','payments','shipment','sellers','products','tax','fraud','revenue']
def create_table_loop(table_name):
spark.sql(f"create table loop_db.{table_name}(id int, name string)")
loop_start_time = time.time()
for table in table_list:
create_table_loop(table)
loop_end_time = time.time()
print(f"Create table by loop completed: {loop_end_time - loop_start_time}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment