lmstack 3 years ago
parent
commit
b4cf4d11ac
1 changed files with 405 additions and 53 deletions
  1. 405 53
      LIB/OTHER/scripts/read_hbase.ipynb

+ 405 - 53
LIB/OTHER/scripts/read_hbase.ipynb

@@ -33,30 +33,42 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 1,
+   "execution_count": 67,
    "metadata": {},
    "outputs": [
     {
-     "ename": "OSError",
-     "evalue": "Could not find KfW installation. Please download and install the 64bit Kerberos for Windows MSI from https://web.mit.edu/KERBEROS/dist and ensure the 'bin' folder (C:\\Program Files\\MIT\\Kerberos\\bin) is in your PATH.",
-     "output_type": "error",
-     "traceback": [
-      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
-      "\u001b[1;31mOSError\u001b[0m                                   Traceback (most recent call last)",
-      "Input \u001b[1;32mIn [1]\u001b[0m, in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mphoenixdb\u001b[39;00m\n\u001b[0;32m      3\u001b[0m database_url \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mhttp://ld-bp16866o8uwo0a590-proxy-lindorm-pub.lindorm.rds.aliyuncs.com:30060\u001b[39m\u001b[38;5;124m\"\u001b[39m  \u001b[38;5;66;03m# \u001b[39;00m\n\u001b[0;32m      5\u001b[0m \u001b[38;5;28;01mclass\u001b[39;00m \u001b[38;5;21;01mPhoenixConnectionTest\u001b[39;00m:\n",
-      "File \u001b[1;32mD:\\Common\\software\\anaconda\\envs\\algo_dev_env\\lib\\site-packages\\phoenixdb\\__init__.py:17\u001b[0m, in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[38;5;66;03m# Licensed to the Apache Software Foundation (ASF) under one or more\u001b[39;00m\n\u001b[0;32m      2\u001b[0m \u001b[38;5;66;03m# contributor license agreements.  See the NOTICE file distributed with\u001b[39;00m\n\u001b[0;32m      3\u001b[0m \u001b[38;5;66;03m# this work for additional information regarding copyright ownership.\u001b[39;00m\n\u001b[1;32m   (...)\u001b[0m\n\u001b[0;32m     13\u001b[0m \u001b[38;5;66;03m# See the License for the specific language governing permissions and\u001b[39;00m\n\u001b[0;32m     14\u001b[0m \u001b[38;5;66;03m# limitations under the License.\u001b[39;00m\n\u001b[0;32m     15\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01msys\u001b[39;00m\n\u001b[1;32m---> 17\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mgssapi\u001b[39;00m\n\u001b[0;32m     19\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mphoenixdb\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m errors, types\n\u001b[0;32m     20\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mphoenixdb\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mavatica\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m AvaticaClient\n",
-      "File \u001b[1;32mD:\\Common\\software\\anaconda\\envs\\algo_dev_env\\lib\\site-packages\\gssapi\\__init__.py:29\u001b[0m, in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[38;5;124;03m\"\"\"High-Level GSSAPI Bindings\u001b[39;00m\n\u001b[0;32m      2\u001b[0m \n\u001b[0;32m      3\u001b[0m \u001b[38;5;124;03mThe high-level API contains three main classes, which represent\u001b[39;00m\n\u001b[1;32m   (...)\u001b[0m\n\u001b[0;32m     26\u001b[0m \u001b[38;5;124;03m    low-level API functions.\u001b[39;00m\n\u001b[0;32m     27\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m---> 29\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mgssapi\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01m_win_config\u001b[39;00m  \u001b[38;5;66;03m# noqa\u001b[39;00m\n\u001b[0;32m     31\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mgssapi\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mraw\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mtypes\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m NameType, RequirementFlag, AddressType  \u001b[38;5;66;03m# noqa\u001b[39;00m\n\u001b[0;32m     32\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mgssapi\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mraw\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mtypes\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m MechType, IntEnumFlagSet  \u001b[38;5;66;03m# noqa\u001b[39;00m\n",
-      "File \u001b[1;32mD:\\Common\\software\\anaconda\\envs\\algo_dev_env\\lib\\site-packages\\gssapi\\_win_config.py:89\u001b[0m, in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m     85\u001b[0m     error_not_found()\n\u001b[0;32m     88\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m os\u001b[38;5;241m.\u001b[39mname \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mnt\u001b[39m\u001b[38;5;124m'\u001b[39m:  \u001b[38;5;66;03m# Make sure we have the required DLLs\u001b[39;00m\n\u001b[1;32m---> 89\u001b[0m     \u001b[43mconfigure_windows\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n",
-      "File \u001b[1;32mD:\\Common\\software\\anaconda\\envs\\algo_dev_env\\lib\\site-packages\\gssapi\\_win_config.py:85\u001b[0m, in \u001b[0;36mconfigure_windows\u001b[1;34m()\u001b[0m\n\u001b[0;32m     82\u001b[0m         \u001b[38;5;28;01mif\u001b[39;00m kfw_available():\n\u001b[0;32m     83\u001b[0m             \u001b[38;5;28;01mreturn\u001b[39;00m\n\u001b[1;32m---> 85\u001b[0m \u001b[43merror_not_found\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n",
-      "File \u001b[1;32mD:\\Common\\software\\anaconda\\envs\\algo_dev_env\\lib\\site-packages\\gssapi\\_win_config.py:49\u001b[0m, in \u001b[0;36merror_not_found\u001b[1;34m()\u001b[0m\n\u001b[0;32m     47\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21merror_not_found\u001b[39m() \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m     48\u001b[0m     \u001b[38;5;124;03m\"\"\"Raise an OSError detailing that KfW is missing and how to get it\"\"\"\u001b[39;00m\n\u001b[1;32m---> 49\u001b[0m     \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mOSError\u001b[39;00m(\n\u001b[0;32m     50\u001b[0m         \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mCould not find KfW installation. Please download and install \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m     51\u001b[0m         \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mthe 64bit Kerberos for Windows MSI from \u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m and ensure the \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m     52\u001b[0m         \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mbin\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m folder (\u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m) is in your PATH.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m     53\u001b[0m         \u001b[38;5;241m%\u001b[39m (KFW_DL, KFW_BIN)\n\u001b[0;32m     54\u001b[0m     )\n",
-      "\u001b[1;31mOSError\u001b[0m: Could not find KfW installation. Please download and install the 64bit Kerberos for Windows MSI from https://web.mit.edu/KERBEROS/dist and ensure the 'bin' folder (C:\\Program Files\\MIT\\Kerberos\\bin) is in your PATH."
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "desc ods_signal\n",
+      "select distinct VIN as vin from ods_signal\n",
+      "select * from ods_signal where id > '1808931144_LUZAGAAA7MA038095_9223370390704375807' and id < '1808931144_LUZAGAAA7MA038095_9223370390790775807'\n",
+      "select * from ods_signal where id > '1873439984_LUZBGAFBXMA042955_9223370390704375807' and id < '1873439984_LUZBGAFBXMA042955_9223370390790775807'\n",
+      "select * from ods_signal where id > '2033890755_LUZAGBDA8LA005283_9223370390704375807' and id < '2033890755_LUZAGBDA8LA005283_9223370390790775807'\n",
+      "select * from ods_signal where id > '680280554_LUZAGAAA8MA053138_9223370390704375807' and id < '680280554_LUZAGAAA8MA053138_9223370390790775807'\n"
      ]
     }
    ],
    "source": [
     "import phoenixdb\n",
+    "import time\n",
+    "import pandas as pd\n",
+    "\n",
+    "# 计算hash值\n",
+    "class GetHashCode:\n",
+    "    def convert_n_bytes(self,n, b):\n",
+    "        bits = b*8\n",
+    "        return (n + 2**(bits-1)) % 2**bits - 2**(bits-1)\n",
+    "    def convert_4_bytes(self,n):\n",
+    "        return self.convert_n_bytes(n, 4)\n",
+    "    @classmethod\n",
+    "    def getHashCode(cls,s):\n",
+    "        h = 0\n",
+    "        n = len(s)\n",
+    "        for i, c in enumerate(s):\n",
+    "            h = h + ord(c)*31**(n-1-i)\n",
+    "        return cls().convert_4_bytes(h)\n",
     "\n",
-    "database_url = \"http://ld-bp16866o8uwo0a590-proxy-lindorm-pub.lindorm.rds.aliyuncs.com:30060\"  # \n",
     "\n",
     "class PhoenixConnectionTest:\n",
     "\n",
@@ -69,57 +81,397 @@
     "            return r\n",
     "        except AttributeError:\n",
     "            print (\"Failed to connect\")\n",
+    "            \n",
+    "# 连接url\n",
+    "database_url = \"ld-bp16866o8uwo0a590-proxy-lindorm-pub.lindorm.rds.aliyuncs.com:30060\"\n",
     "\n",
-    "connect_kw_args = {'user': 'root', 'password': 'root'}\n",
+    "connect_kw_args = {'lindorm_user': 'root', 'lindorm_password': 'root', 'database': 'test'}\n",
     "db = PhoenixConnectionTest()\n",
     "connection = db._connect(connect_kw_args)\n",
     "\n",
-    "# with connection.cursor() as statement:\n",
-    "#     sql_drop_table = \"drop table if exists test_python\"\n",
-    "#     print (sql_drop_table)\n",
-    "#     statement.execute(sql_drop_table)\n",
-    "#     sql_create_table =\"create table if not exists test_python(c1 int, c2 int, primary key(c1))\"\n",
-    "#     print (sql_create_table)\n",
-    "#     statement.execute(sql_create_table)\n",
-    "\n",
-    "#     sql_upsert = \"upsert into test_python(c1, c2) values(1,1)\"\n",
-    "#     print (sql_upsert)\n",
-    "#     statement.execute(sql_upsert)\n",
-    "\n",
-    "#     sql_select = \"SELECT * FROM test_python\"\n",
-    "#     print (sql_select)\n",
-    "#     statement.execute(sql_select)\n",
-    "#     rows = statement.fetchall()\n",
-    "#     print (rows)\n",
-    "\n",
-    "#     statement.close()\n",
-    "# connection.close"
+    "with connection.cursor() as statement:\n",
+    "    # 创建表\n",
+    "    # sql_create_table = \"create table if not exists test_python(c1 integer, c2 integer, primary key(c1))\"\n",
+    "    # print(sql_create_table)\n",
+    "    # statement.execute(sql_create_table)\n",
+    "\n",
+    "    # # 插入一行数据\n",
+    "    # sql_upsert = \"upsert into test_python(c1, c2) values(1,1)\"\n",
+    "    # print(sql_upsert)\n",
+    "    # statement.execute(sql_upsert)\n",
+    "\n",
+    "    # # 插入多行数据\n",
+    "    # with connection.cursor() as stat:\n",
+    "    #     sql_upsert = \"upsert into test_python(c1, c2) values(?,?)\"\n",
+    "    #     print(sql_upsert)\n",
+    "    #     stat.executemany(sql_upsert, [(2, 2), (3, 3)])\n",
+    "\n",
+    "    # # 删除数据\n",
+    "    # sql_delete = \"delete from test_python where c1=2\"\n",
+    "    # print(sql_delete)\n",
+    "    # statement.execute(sql_delete)\n",
+    "\n",
+    "    # # 修改数据\n",
+    "    # sql_update = \"upsert into test_python(c1, c2) values(1,10)\"\n",
+    "    # print(sql_update)\n",
+    "    # statement.execute(sql_update)\n",
+    "\n",
+    "    # 获取列名\n",
+    "    sql_select = \"desc ods_signal\"\n",
+    "    print(sql_select)\n",
+    "    statement.execute(sql_select)\n",
+    "    rows = statement.fetchall()\n",
+    "    columns = []\n",
+    "    for r in rows:\n",
+    "        columns.append(r[2])\n",
+    "        \n",
+    "    # 获取vin列表\n",
+    "    sql_select = \"select distinct VIN as vin from ods_signal\"\n",
+    "    print(sql_select)\n",
+    "    statement.execute(sql_select)\n",
+    "    rows = statement.fetchall()\n",
+    "    vins = []\n",
+    "    for r in rows:\n",
+    "        vins.append(r[0])\n",
+    "    vins = list(set(vins))\n",
+    "    \n",
+    "    # 获取数据\n",
+    "    MAX_LONG=9223372036854775807\n",
+    "    # 参数起始时间,结束时间,vin\n",
+    "    start_time = '2022-03-01 00:00:00'\n",
+    "    end_time = '2022-03-02 00:00:00'\n",
+    "    st = int(time.mktime(time.strptime(start_time,'%Y-%m-%d %H:%M:%S')) * 1000)\n",
+    "    et = int(time.mktime(time.strptime(end_time,'%Y-%m-%d %H:%M:%S')) * 1000)\n",
+    "    \n",
+    "    dfs = []\n",
+    "    for vin in vins:\n",
+    "        \n",
+    "        prefix = str(abs(GetHashCode.getHashCode(vin)))+\"_\"+vin+\"_\"\n",
+    "        start_rows = prefix + str(MAX_LONG-et)\n",
+    "        end_rows = prefix + str(MAX_LONG-st)\n",
+    "        sql_select = \"select * from ods_signal where id > '{}' and id < '{}'\".format(start_rows, end_rows)\n",
+    "        print(sql_select)\n",
+    "        statement.execute(sql_select)\n",
+    "        rows = statement.fetchall()\n",
+    "        dfs.append(pd.DataFrame(rows, columns=columns))\n",
+    "    \n",
+    "    \n",
+    "\n",
+    "    # # 禁用表,删除表之前需要先禁用表\n",
+    "    # sql_offline_table = \"offline table test_python\"\n",
+    "    # print(sql_offline_table)\n",
+    "    # statement.execute(sql_offline_table)\n",
+    "\n",
+    "    # # 删除表\n",
+    "    # sql_drop_table = \"drop table if exists test_python\"\n",
+    "    # print(sql_drop_table)\n",
+    "    # statement.execute(sql_drop_table)\n",
+    "\n",
+    "connection.close()"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 69,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "a = 0\n",
+    "for df in dfs:\n",
+    "    a = a + len(df)"
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 2,
+   "execution_count": 70,
    "metadata": {},
    "outputs": [
     {
-     "ename": "OSError",
-     "evalue": "Could not find KfW installation. Please download and install the 64bit Kerberos for Windows MSI from https://web.mit.edu/KERBEROS/dist and ensure the 'bin' folder (C:\\Program Files\\MIT\\Kerberos\\bin) is in your PATH.",
-     "output_type": "error",
-     "traceback": [
-      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
-      "\u001b[1;31mOSError\u001b[0m                                   Traceback (most recent call last)",
-      "Input \u001b[1;32mIn [2]\u001b[0m, in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mphoenixdb\u001b[39;00m\n",
-      "File \u001b[1;32mD:\\Common\\software\\anaconda\\envs\\algo_dev_env\\lib\\site-packages\\phoenixdb\\__init__.py:17\u001b[0m, in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[38;5;66;03m# Licensed to the Apache Software Foundation (ASF) under one or more\u001b[39;00m\n\u001b[0;32m      2\u001b[0m \u001b[38;5;66;03m# contributor license agreements.  See the NOTICE file distributed with\u001b[39;00m\n\u001b[0;32m      3\u001b[0m \u001b[38;5;66;03m# this work for additional information regarding copyright ownership.\u001b[39;00m\n\u001b[1;32m   (...)\u001b[0m\n\u001b[0;32m     13\u001b[0m \u001b[38;5;66;03m# See the License for the specific language governing permissions and\u001b[39;00m\n\u001b[0;32m     14\u001b[0m \u001b[38;5;66;03m# limitations under the License.\u001b[39;00m\n\u001b[0;32m     15\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01msys\u001b[39;00m\n\u001b[1;32m---> 17\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mgssapi\u001b[39;00m\n\u001b[0;32m     19\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mphoenixdb\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m errors, types\n\u001b[0;32m     20\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mphoenixdb\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mavatica\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m AvaticaClient\n",
-      "File \u001b[1;32mD:\\Common\\software\\anaconda\\envs\\algo_dev_env\\lib\\site-packages\\gssapi\\__init__.py:29\u001b[0m, in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[38;5;124;03m\"\"\"High-Level GSSAPI Bindings\u001b[39;00m\n\u001b[0;32m      2\u001b[0m \n\u001b[0;32m      3\u001b[0m \u001b[38;5;124;03mThe high-level API contains three main classes, which represent\u001b[39;00m\n\u001b[1;32m   (...)\u001b[0m\n\u001b[0;32m     26\u001b[0m \u001b[38;5;124;03m    low-level API functions.\u001b[39;00m\n\u001b[0;32m     27\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m---> 29\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mgssapi\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01m_win_config\u001b[39;00m  \u001b[38;5;66;03m# noqa\u001b[39;00m\n\u001b[0;32m     31\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mgssapi\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mraw\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mtypes\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m NameType, RequirementFlag, AddressType  \u001b[38;5;66;03m# noqa\u001b[39;00m\n\u001b[0;32m     32\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mgssapi\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mraw\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mtypes\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m MechType, IntEnumFlagSet  \u001b[38;5;66;03m# noqa\u001b[39;00m\n",
-      "File \u001b[1;32mD:\\Common\\software\\anaconda\\envs\\algo_dev_env\\lib\\site-packages\\gssapi\\_win_config.py:89\u001b[0m, in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m     85\u001b[0m     error_not_found()\n\u001b[0;32m     88\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m os\u001b[38;5;241m.\u001b[39mname \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mnt\u001b[39m\u001b[38;5;124m'\u001b[39m:  \u001b[38;5;66;03m# Make sure we have the required DLLs\u001b[39;00m\n\u001b[1;32m---> 89\u001b[0m     \u001b[43mconfigure_windows\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n",
-      "File \u001b[1;32mD:\\Common\\software\\anaconda\\envs\\algo_dev_env\\lib\\site-packages\\gssapi\\_win_config.py:85\u001b[0m, in \u001b[0;36mconfigure_windows\u001b[1;34m()\u001b[0m\n\u001b[0;32m     82\u001b[0m         \u001b[38;5;28;01mif\u001b[39;00m kfw_available():\n\u001b[0;32m     83\u001b[0m             \u001b[38;5;28;01mreturn\u001b[39;00m\n\u001b[1;32m---> 85\u001b[0m \u001b[43merror_not_found\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n",
-      "File \u001b[1;32mD:\\Common\\software\\anaconda\\envs\\algo_dev_env\\lib\\site-packages\\gssapi\\_win_config.py:49\u001b[0m, in \u001b[0;36merror_not_found\u001b[1;34m()\u001b[0m\n\u001b[0;32m     47\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21merror_not_found\u001b[39m() \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m     48\u001b[0m     \u001b[38;5;124;03m\"\"\"Raise an OSError detailing that KfW is missing and how to get it\"\"\"\u001b[39;00m\n\u001b[1;32m---> 49\u001b[0m     \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mOSError\u001b[39;00m(\n\u001b[0;32m     50\u001b[0m         \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mCould not find KfW installation. Please download and install \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m     51\u001b[0m         \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mthe 64bit Kerberos for Windows MSI from \u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m and ensure the \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m     52\u001b[0m         \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mbin\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m folder (\u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m) is in your PATH.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m     53\u001b[0m         \u001b[38;5;241m%\u001b[39m (KFW_DL, KFW_BIN)\n\u001b[0;32m     54\u001b[0m     )\n",
-      "\u001b[1;31mOSError\u001b[0m: Could not find KfW installation. Please download and install the 64bit Kerberos for Windows MSI from https://web.mit.edu/KERBEROS/dist and ensure the 'bin' folder (C:\\Program Files\\MIT\\Kerberos\\bin) is in your PATH."
-     ]
+     "data": {
+      "text/plain": [
+       "25671"
+      ]
+     },
+     "execution_count": 70,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "# 计算id hash\n",
+    "a"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 43,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "9223370390727590241"
+      ]
+     },
+     "execution_count": 43,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "MAX_LONG - 1646127185566"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 50,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "1646064000000"
+      ]
+     },
+     "execution_count": 50,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": []
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 37,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "[['1808931144_LUZAGAAA7MA038095_9223370390727590241',\n",
+       "  '2105094752_0CZPE007DN0111B800000059_9223370390727590241',\n",
+       "  'LUZAGAAA7MA038095',\n",
+       "  'EP12',\n",
+       "  2,\n",
+       "  1646127185566,\n",
+       "  '4.006,4.009,4.009,4.011,4.008,4.009,4.010,4.009,4.010,4.010,4.009,4.010,4.005,4.009,4.009,4.009,4.010,4.009,4.010,4.009,4.009,4.008,4.008,4.010,4.006,4.010,4.010,4.009,4.009,4.010,4.009,4.008,4.008,4.006,4.009,4.009,4.008,4.009,4.010,4.009,4.009,4.010,4.009,4.010,4.009,4.009,4.010,4.011,4.009,4.011,4.012,4.012,4.011,4.011,4.011,4.011,4.011,4.010,4.010,4.010,4.006,4.010,4.009,4.010,4.009,4.009,4.009,4.006,4.008,4.009,4.010,4.009,4.006,4.009,4.008,4.010,4.010,4.011,4.008,4.010,4.011,4.009,4.009,4.009,4.011,4.005,4.009,4.011,4.010,4.009,4.010,4.010,4.009,4.009,4.009,4.010',\n",
+       "  Decimal('384.600006'),\n",
+       "  66,\n",
+       "  99,\n",
+       "  '12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12',\n",
+       "  1,\n",
+       "  29,\n",
+       "  Decimal('0.000000'),\n",
+       "  Decimal('324.500000'),\n",
+       "  Decimal('3927.900000'),\n",
+       "  None,\n",
+       "  0,\n",
+       "  Decimal('0.000000'),\n",
+       "  0,\n",
+       "  Decimal('77.000000'),\n",
+       "  Decimal('0.000000'),\n",
+       "  Decimal('255.000000'),\n",
+       "  Decimal('4000.000000'),\n",
+       "  3,\n",
+       "  Decimal('115.956260'),\n",
+       "  Decimal('30.075305'),\n",
+       "  Decimal('14.500000'),\n",
+       "  65535,\n",
+       "  4,\n",
+       "  0,\n",
+       "  -999999999,\n",
+       "  -999999999,\n",
+       "  -999999999,\n",
+       "  Decimal('-999999999.000000'),\n",
+       "  Decimal('-999999999.000000'),\n",
+       "  0,\n",
+       "  -999999999,\n",
+       "  255,\n",
+       "  Decimal('65535.000000'),\n",
+       "  Decimal('65535.000000'),\n",
+       "  -999999999,\n",
+       "  -999999999,\n",
+       "  -999999999,\n",
+       "  -999999999,\n",
+       "  0,\n",
+       "  -999999999,\n",
+       "  0,\n",
+       "  -999999999,\n",
+       "  Decimal('-999999999.000000'),\n",
+       "  Decimal('-999999999.000000'),\n",
+       "  0,\n",
+       "  255,\n",
+       "  0,\n",
+       "  0,\n",
+       "  Decimal('4012.000000'),\n",
+       "  Decimal('4006.000000'),\n",
+       "  Decimal('12.000000'),\n",
+       "  Decimal('11.000000'),\n",
+       "  Decimal('94.000000'),\n",
+       "  Decimal('-0.300000'),\n",
+       "  Decimal('0.189999'),\n",
+       "  Decimal('65535.000000'),\n",
+       "  255,\n",
+       "  Decimal('65535.000000'),\n",
+       "  0,\n",
+       "  0,\n",
+       "  0,\n",
+       "  0,\n",
+       "  Decimal('65535.000000'),\n",
+       "  Decimal('65535.000000'),\n",
+       "  Decimal('65535.000000'),\n",
+       "  Decimal('65535.000000'),\n",
+       "  Decimal('0.000000'),\n",
+       "  Decimal('0.000000'),\n",
+       "  Decimal('65535.000000'),\n",
+       "  65535,\n",
+       "  255,\n",
+       "  255,\n",
+       "  0,\n",
+       "  Decimal('4294967295.000000'),\n",
+       "  Decimal('4294967295.000000'),\n",
+       "  0,\n",
+       "  1640988682000,\n",
+       "  96,\n",
+       "  1,\n",
+       "  96,\n",
+       "  32,\n",
+       "  '0CZPE007DN0111B800000059',\n",
+       "  'E',\n",
+       "  -999999999,\n",
+       "  '2101TAB',\n",
+       "  122,\n",
+       "  '2P96S',\n",
+       "  'J9',\n",
+       "  '华鼎国联动力电池有限公司',\n",
+       "  3,\n",
+       "  '华鼎国联动力电池有限公司']]"
+      ]
+     },
+     "execution_count": 37,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "rows"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 39,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "['id',\n",
+       " 'SnKey',\n",
+       " 'VIN',\n",
+       " 'VehModel',\n",
+       " 'VehState',\n",
+       " 'Time',\n",
+       " 'CellVoltage',\n",
+       " 'PackVoltage',\n",
+       " 'CellMaxVolNum',\n",
+       " 'CellMinVolNum',\n",
+       " 'CellTemp',\n",
+       " 'CellMaxTempNum',\n",
+       " 'CellMinTempNum',\n",
+       " 'PackCrnt',\n",
+       " 'VehRmnRng',\n",
+       " 'VehOdo',\n",
+       " 'FltCode',\n",
+       " 'FltLvl',\n",
+       " 'VehSpd',\n",
+       " 'PedalAngle',\n",
+       " 'PackSoc',\n",
+       " 'MotorPwr',\n",
+       " 'EnmTemp',\n",
+       " 'InsulationRss',\n",
+       " 'ChrgSta',\n",
+       " 'GPS_lon',\n",
+       " 'GPS_lat',\n",
+       " 'GPS_alt',\n",
+       " 'PowerAlreadyTime',\n",
+       " 'BMSSta',\n",
+       " 'ACSta',\n",
+       " 'HVILSta',\n",
+       " 'OfcAccumTime',\n",
+       " 'BmsOncChgCp',\n",
+       " 'BmsOfcPileOutputVol',\n",
+       " 'BmsOfcPileOutputCur',\n",
+       " 'BmsOfcCc',\n",
+       " 'BmsOfcAllowed',\n",
+       " 'OncCmState',\n",
+       " 'OncOutCurrent',\n",
+       " 'OncOutVoltage',\n",
+       " 'OfcStationMaxOutVolt',\n",
+       " 'OfcStationMinOutVolt',\n",
+       " 'OfcStationMaxOutCrnt',\n",
+       " 'OfcStationMinOutCrnt',\n",
+       " 'BmsOfcgVoltageRequest',\n",
+       " 'BmsOfcType',\n",
+       " 'BmsOfcCurrentRequest',\n",
+       " 'BmsOncChgRequest',\n",
+       " 'BmsRequestOutputCurrent',\n",
+       " 'BmsRequestOutputVoltage',\n",
+       " 'BmsOncCc',\n",
+       " 'BmsS2State',\n",
+       " 'HvUpState',\n",
+       " 'HvDownState',\n",
+       " 'CellMaxVol',\n",
+       " 'CellMinVol',\n",
+       " 'CellMaxTemp',\n",
+       " 'CellMinTemp',\n",
+       " 'Tripmeter',\n",
+       " 'VehAccX',\n",
+       " 'VehAccY',\n",
+       " 'StringAngle',\n",
+       " 'PTCSta',\n",
+       " 'PTCPwr',\n",
+       " 'PosRlySta',\n",
+       " 'NegRlySta',\n",
+       " 'OfcPreRlySta',\n",
+       " 'OfcRlySta',\n",
+       " 'OfcPosChrgerTemp',\n",
+       " 'OfcNegChrgerTemp',\n",
+       " 'OncPosChrgerTemp',\n",
+       " 'OncNegChrgerTemp',\n",
+       " 'InstPwrCmsmtion',\n",
+       " 'AvgPwrCmsmtion',\n",
+       " 'SubPwrCmsmtion',\n",
+       " 'BmsCellVoltDiff',\n",
+       " 'DriveMode',\n",
+       " 'BmsBatTempDiff',\n",
+       " 'BmsClmThermalSts',\n",
+       " 'BmsBatteryTotalCapacity',\n",
+       " 'BmsBatteryAvaiCapacity',\n",
+       " 'BmsOncChgCpConn',\n",
+       " 'CellVoltRecTime',\n",
+       " 'CellVoltTotalCount',\n",
+       " 'CellVoltFrameNo',\n",
+       " 'CellVoltFrameCount',\n",
+       " 'CellTempTotalCount',\n",
+       " 'SN',\n",
+       " 'CellBatteryType',\n",
+       " 'OncAccumTime',\n",
+       " 'PackModelCode',\n",
+       " 'PackCapacity',\n",
+       " 'PackSeriesParallerl',\n",
+       " 'ModuleModelCode',\n",
+       " 'ModuleManufactory',\n",
+       " 'CellDictShape',\n",
+       " 'CellManufactory']"
+      ]
+     },
+     "execution_count": 39,
+     "metadata": {},
+     "output_type": "execute_result"
     }
    ],
    "source": [
-    "import phoenixdb"
+    "columns"
    ]
   },
   {
@@ -149,7 +501,7 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.8.12"
+   "version": "3.8.8"
   },
   "orig_nbformat": 4
  },