3 python 如何 unsubscribeTable

https://docs.dolphindb.cn/zh/help/FunctionsandCommands/CommandsReferences/u/unsubscribeTable.html


```

s.subscribe("127.0.0.1", 8848, handler, "OHLC5","python_api_subscribe",0)

     ...: 

     ...: s.unsubscribeTable("OHLC5","python_api_subscribe",)

     ...: 

     ...: 

---------------------------------------------------------------------------

AttributeError                            Traceback (most recent call last)

<ipython-input-114-dda6a488b836> in <module>

      1 #s.subscribe("127.0.0.1", 8848, handler, "OHLC5","python_api_subscribe",0

      2 

----> 3 s.unsubscribeTable("OHLC5","python_api_subscribe",)

      4 


AttributeError: 'Session' object has no attribute 'unsubscribeTable'


```

2023年11月28日 更新: 还是不行  为什么  可以看见Trade表是存在的

In [86]: s.run('''
    ...: objs(true)
    ...: ''')
    ...: 
    ...: 
Out[86]: 
    name      type   form   rows  columns   bytes  shared extra
0  Trade  REALTIME  TABLE  31196        4  748700    True      

In [79]: s.run('getSubscriptionTopic("Trade","act_tsAggr1")')                               
Out[79]:                                      
['localhost:8848:local8848/Trade/act_tsAggr1',                                              
 array(['Symbol', 'Datetime', 'Price', 'Volume'], dtype=object)]                            

In [80]: s.run('getSubscriptionTopic("Trade2")')                                            
Out[80]: ['localhost:8848:local8848/Trade2', None]                                          

In [81]: s.run('getSubscriptionTopic("Trade")')                                             
Out[81]:                                      
['localhost:8848:local8848/Trade',            
 array(['Symbol', 'Datetime', 'Price', 'Volume'], dtype=object)]                            

In [82]: s.unsubscribe("localhost",8848,'Trade',actionName=None)                            
---------------------------------------------------------------------------                 
RuntimeError                              Traceback (most recent call last)                 
<ipython-input-82-090db2d896dd> in <module>   
----> 1 s.unsubscribe("localhost",8848,'Trade',actionName=None)                             

~/.local/lib/python3.8/site-packages/dolphindb/session.py in unsubscribe(self, host, port, tableName, actionName)                                                                        
    598         if actionName is None:        
    599             actionName = ""           
--> 600         self.cpp.unsubscribe(host, port, tableName, actionName)                     
    601                                       
    602     def getSubscriptionTopics(self) -> List[str]:                                   

RuntimeError: subscription localhost/8848/Trade/ not exists                                 




请先 登录 后评论

1 个回答

wfHuang
s.unsubscribe(host,port,tableName,actionName=None)
阅读下python api文档吧:
https://gitee.com/dolphindb/api_python3
请先 登录 后评论