refactor: Prevent duplicate table creation messages in trading_plan table
This commit is contained in:
parent
f291cd631f
commit
11da135ea2
@ -78,6 +78,18 @@ def create_trading_plan_table():
|
|||||||
"""Create the trading plans table if it doesn't exist"""
|
"""Create the trading plans table if it doesn't exist"""
|
||||||
with create_client() as client:
|
with create_client() as client:
|
||||||
try:
|
try:
|
||||||
|
# First check if table exists
|
||||||
|
check_query = """
|
||||||
|
SELECT name
|
||||||
|
FROM system.tables
|
||||||
|
WHERE database = currentDatabase()
|
||||||
|
AND name = 'trading_plans'
|
||||||
|
"""
|
||||||
|
result = client.query(check_query)
|
||||||
|
|
||||||
|
if result.result_rows:
|
||||||
|
return # Table already exists, silently return
|
||||||
|
|
||||||
# Create new table with a structure that supports updates
|
# Create new table with a structure that supports updates
|
||||||
query = """
|
query = """
|
||||||
CREATE TABLE IF NOT EXISTS trading_plans
|
CREATE TABLE IF NOT EXISTS trading_plans
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user