Database deletes via Python OLE automation

New AB user here. I am planning to use Python for as much database CRUD (create, read, update, deletes) as possible via OLE automation.

I have been able to get Python to work for following operations: create symbol, create quotes (ASCII import), read quotes (ASCII export), read symbol information, and update symbol information. For benefit of forum users, following is code that dumps futures information pertinent for backtest into a Pandas dataframe (so I can check the settings are correct):

from win32com.client import Dispatch
import pandas as pd
cols = [
    'ticker',
    'fullname',
    'pointvalue',
    'ticksize',
    'margindeposit',
    'roundlotsize'
]
df = pd.DataFrame(columns=cols)
ab = Dispatch("Broker.Application")
for ix, stock in enumerate(ab.Stocks):
    df.loc[ix] = (stock.Ticker,
                  stock.FullName,
                  stock.PointValue,
                  stock.TickSize,
                  stock.MarginDeposit,
                  stock.RoundLotSize)
print(df)

However, I have not been able to get database deletes (symbol delete or quote deletes) to work in Python. I have verified they do work via the JavaScript code examples given by TJ.

Specifically, Stocks.Remove() and Quotations.Remove() OLE operations in Python return Python "TypeError: bool object is not callable".

Here is full Python script for a symbol delete. (Yes, I know one should not hard code an index like 14. But this is on my test database and I am fine with symbol #14 being deleted). I would appreciate any help from anyone who has gotten this to work from Python.

from win32com.client import Dispatch
ab = Dispatch("Broker.Application")
stocks = ab.Stocks
stocks.Remove(14)

Thanks.

I am having the exact same problem. Actually, this method is being comprehended as an internal variable. If you run ab.Stocks.Remove it will return False. When you call ab.Stocks.Remove() the interpreter understands you are calling False(). And unfortunately I have no idea how to solve it in Python. What I did was to run a jscript from Python. Maybe not the best solution, but as we joke here in Brazil: "If it works, then it isn't stupid". Anyway, It would be very nice a opinion from more advanced programmers for that matter.

@erictrevisani @alpha1 Did you guys get a solution to the problem ?