Skip to content

Commit b296484

Browse files
committed
add size on disk property
1 parent 923c2a7 commit b296484

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

datajoint/schema.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ def __repr__(self):
7676
database=self.database,
7777
context=self.context['__name__'] if '__name__' in self.context else "__")
7878

79+
@property
80+
def size_on_disk(self):
81+
return float(self.connection.query(
82+
"""SELECT Sum(data_length + index_length) FROM information_schema.tables WHERE table_schema='{}';""".format(
83+
self.database)).fetchone()[0])
84+
7985
def spawn_missing_classes(self):
8086
"""
8187
Creates the appropriate python user relation classes from tables in the database and places them

0 commit comments

Comments
 (0)