mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-17 14:04:20 +01:00
Add names_only parameter to get_columns_for_table (#2219)
This commit is contained in:
@@ -22,12 +22,14 @@ def get_all_tables(op):
|
|||||||
return tables
|
return tables
|
||||||
|
|
||||||
|
|
||||||
def get_columns_for_table(op, table_name):
|
def get_columns_for_table(op, table_name, names_only=False):
|
||||||
"""
|
"""
|
||||||
Function to list the columns in a table from a migration
|
Function to list the columns in a table from a migration
|
||||||
"""
|
"""
|
||||||
inspector = SQLAInspect(op.get_bind())
|
inspector = SQLAInspect(op.get_bind())
|
||||||
columns = inspector.get_columns(table_name)
|
columns = inspector.get_columns(table_name)
|
||||||
|
if names_only is True:
|
||||||
|
columns = [c["name"] for c in columns]
|
||||||
return columns
|
return columns
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user