2 Comments
Apr 26, 2023Liked by Avi Chawla

Thanks Avi, but one point: COUNT(*) only returns the number of rows in a table, so it's not the full equivalent of df.shape.

For the number of columns one can use:

SELECT COUNT(*)

FROM INFORMATION_SCHEMA.COLUMNS

WHERE table_catalog = 'database_name' -- the database

AND table_name = 'table_name'

Expand full comment