Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
NickA01
Resolver III
Resolver III

Notebook for checking lakehouse table row counts.

Hi All. 

I've been trying to look at metadata for a fabric lakehouse. 
Comming from many years of experience, I was looking at doing something with the SQL endpint, information schema ect but that wasn't playing nicely so I've bodged this notebook together. 

Hopefully it will be of use to some people. 


# get all databases in the workspace that start with "xxxxx"
databases = [database.name for database in spark.catalog.listDatabases() if database.name.startswith("WhiteSpace")]
print(databases)
# works 🙂 #

# set database context #
for database in databases:
    print(f"Tables in database {database}:")
 # set the current database
    spark.catalog.setCurrentDatabase(database)

#loop through tables and
tables = spark.catalog.listTables()
lh_tabledata=[]
for table in tables:
    name=table.name
    lh_tabledata.append({"Database": database,"Tables":name,"Rows": spark.read.table(name).count()})

df_metadata = spark.createDataFrame(lh_tabledata)
df_metadata.show(df_metadata.count(),truncate=False)

 

The Nick

If the post helps please give a thumbs up || If it solves your issue, please accept it as the solution to help the other members find it more quickly.

If it's the biggest heap of stinky smelly stuff then I'm sorry .

1 ACCEPTED SOLUTION

@Anonymous , just sharing info for the hive mind.  😎

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @NickA01 ,

Thanks for using Fabric Community.
Is this a question posted? Or were you sharing some information in this thread?

Can you please confirm it?

@Anonymous , just sharing info for the hive mind.  😎

Helpful resources

Announcements
September Fabric Update Carousel

Fabric Monthly Update - September 2025

Check out the September 2025 Fabric update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.