DBManager.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <html><head><title>Python: module DBManager</title>
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  4. </head><body bgcolor="#f0f0f8">
  5. <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
  6. <tr bgcolor="#7799ee">
  7. <td valign=bottom>&nbsp;<br>
  8. <font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong>DBManager</strong></big></big></font></td
  9. ><td align=right valign=bottom
  10. ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:f%3A%5Cwork%5Cqx%5Cdata_analyze_platform%5Clib%5Cbackend%5Cdbmanager.py">f:\work\qx\data_analyze_platform\lib\backend\dbmanager.py</a></font></td></tr></table>
  11. <p><tt>暂时采用http方式获取历史数据。<br>
  12. &nbsp;<br>
  13. 预留:后期若改用通过访问数据库的形式进行数据的获取,则本文件负责数据库的连接,sql指令的执行,数据获取等功能。</tt></p>
  14. <p>
  15. <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
  16. <tr bgcolor="#aa55cc">
  17. <td colspan=3 valign=bottom>&nbsp;<br>
  18. <font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
  19. <tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
  20. <td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="datetime.html">datetime</a><br>
  21. <a href="json.html">json</a><br>
  22. <a href="numpy.html">numpy</a><br>
  23. </td><td width="25%" valign=top><a href="os.html">os</a><br>
  24. <a href="pandas.html">pandas</a><br>
  25. <a href="pdb.html">pdb</a><br>
  26. </td><td width="25%" valign=top><a href="requests.html">requests</a><br>
  27. <a href="time.html">time</a><br>
  28. <a href="urllib.html">urllib</a><br>
  29. </td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
  30. <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
  31. <tr bgcolor="#ee77aa">
  32. <td colspan=3 valign=bottom>&nbsp;<br>
  33. <font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
  34. <tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
  35. <td width="100%"><dl>
  36. <dt><font face="helvetica, arial"><a href="builtins.html#object">builtins.object</a>
  37. </font></dt><dd>
  38. <dl>
  39. <dt><font face="helvetica, arial"><a href="DBManager.html#DBManager">DBManager</a>
  40. </font></dt></dl>
  41. </dd>
  42. </dl>
  43. <p>
  44. <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
  45. <tr bgcolor="#ffc8d8">
  46. <td colspan=3 valign=bottom>&nbsp;<br>
  47. <font color="#000000" face="helvetica, arial"><a name="DBManager">class <strong>DBManager</strong></a>(<a href="builtins.html#object">builtins.object</a>)</font></td></tr>
  48. <tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
  49. <td colspan=2><tt><a href="#DBManager">DBManager</a>(host='',&nbsp;port='',&nbsp;auth='',&nbsp;db='',&nbsp;username='',&nbsp;password='')<br>
  50. &nbsp;<br>
  51. #&nbsp;import&nbsp;http.client<br>
  52. #&nbsp;http.client.HTTPConnection._http_vsn&nbsp;=&nbsp;10<br>
  53. #&nbsp;http.client.HTTPConnection._http_vsn_str&nbsp;=&nbsp;'HTTP/1.1'<br>&nbsp;</tt></td></tr>
  54. <tr><td>&nbsp;</td>
  55. <td width="100%">Methods defined here:<br>
  56. <dl><dt><a name="DBManager-__enter__"><strong>__enter__</strong></a>(self)</dt></dl>
  57. <dl><dt><a name="DBManager-__exit__"><strong>__exit__</strong></a>(self)</dt></dl>
  58. <dl><dt><a name="DBManager-__init__"><strong>__init__</strong></a>(self, host='', port='', auth='', db='', username='', password='')</dt><dd><tt>Initialize&nbsp;self.&nbsp;&nbsp;See&nbsp;help(type(self))&nbsp;for&nbsp;accurate&nbsp;signature.</tt></dd></dl>
  59. <dl><dt><a name="DBManager-close"><strong>close</strong></a>(self)</dt></dl>
  60. <dl><dt><a name="DBManager-connect"><strong>connect</strong></a>(self)</dt></dl>
  61. <dl><dt><a name="DBManager-get_data"><strong>get_data</strong></a>(self, url='http://172.16.126.13/store/load?dataType={}&amp;limit=0&amp;sn={}', sn='', start_time='', end_time='', data_groups=['bms', 'gps'])</dt><dd><tt>获取指定&nbsp;sn&nbsp;和起止日期的bms和gps数据.<br>
  62. 添加了重试机制。<br>
  63. &nbsp;<br>
  64. --------------输入参数------------<br>
  65. url:数据获取url,&nbsp;可采用默认值<br>
  66. sn:&nbsp;str,&nbsp;电池sn号<br>
  67. start_time:&nbsp;str,&nbsp;开始时间<br>
  68. end_time:&nbsp;str,&nbsp;结束时间<br>
  69. data_groups:&nbsp;&nbsp;选择需要获取的数据组,可填入多个字符串(默认只获取bms和gps数据)<br>
  70. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bms:&nbsp;bms数据<br>
  71. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gps:gps数据<br>
  72. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;system:system数据<br>
  73. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;accum:accum数据<br>
  74. &nbsp;<br>
  75. &nbsp;<br>
  76. --------------输出参数------------<br>
  77. df_data:&nbsp;{'bms':dataframe,&nbsp;'gps':dataframe,&nbsp;'system':dataframe,&nbsp;;accum':dataframe}</tt></dd></dl>
  78. <hr>
  79. Data descriptors defined here:<br>
  80. <dl><dt><strong>__dict__</strong></dt>
  81. <dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
  82. </dl>
  83. <dl><dt><strong>__weakref__</strong></dt>
  84. <dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
  85. </dl>
  86. </td></tr></table></td></tr></table><p>
  87. <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
  88. <tr bgcolor="#55aa55">
  89. <td colspan=3 valign=bottom>&nbsp;<br>
  90. <font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
  91. <tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
  92. <td width="100%"><strong>S</strong> = &lt;RegexFlag.DOTALL: 16&gt;</td></tr></table><p>
  93. <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
  94. <tr bgcolor="#7799ee">
  95. <td colspan=3 valign=bottom>&nbsp;<br>
  96. <font color="#ffffff" face="helvetica, arial"><big><strong>Author</strong></big></font></td></tr>
  97. <tr><td bgcolor="#7799ee"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
  98. <td width="100%">lmstack</td></tr></table>
  99. </body></html>