File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed
Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -768,6 +768,7 @@ def create_table_sql(
768768 # Soundness check not_null, and defaults if provided
769769 not_null = not_null or set ()
770770 defaults = defaults or {}
771+ assert columns , "Tables must have at least one column"
771772 assert all (
772773 n in columns for n in not_null
773774 ), "not_null set {} includes items not in columns {}" .format (
Original file line number Diff line number Diff line change @@ -1149,3 +1149,9 @@ def test_create_if_not_exists(fresh_db):
11491149 fresh_db ["t" ].create ({"id" : int })
11501150 # This should not
11511151 fresh_db ["t" ].create ({"id" : int }, if_not_exists = True )
1152+
1153+
1154+ def test_create_if_no_columns (fresh_db ):
1155+ with pytest .raises (AssertionError ) as error :
1156+ fresh_db ["t" ].create ({})
1157+ assert error .value .args [0 ] == "Tables must have at least one column"
You can’t perform that action at this time.
0 commit comments