From eb05de266ab20557fcdfb128508f8e08e3171ad7 Mon Sep 17 00:00:00 2001 From: Jeff Date: Thu, 27 Nov 2025 16:18:26 -0400 Subject: [PATCH] start of removing database requirement --- example_notebook.ipynb | 56 ++++++++++++++++++++++++++++++++++---- jepl/Tables/CEC21Tables.py | 33 ++++++++++++++++++++++ jepl/jepl_circuits.py | 21 +++++++++++++- 3 files changed, 103 insertions(+), 7 deletions(-) create mode 100644 jepl/Tables/CEC21Tables.py diff --git a/example_notebook.ipynb b/example_notebook.ipynb index 38c9be3..f77f108 100644 --- a/example_notebook.ipynb +++ b/example_notebook.ipynb @@ -2,12 +2,56 @@ "cells": [ { "cell_type": "code", - "execution_count": 20, + "execution_count": 2, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/home/jeff/projects/JEPL/jepl/jepl_templates.py:40: SyntaxWarning: invalid escape sequence '\\w'\n", + " warning_text = '\\warning WARNING'\n", + "/home/jeff/projects/JEPL/jepl/jepl_templates.py:43: SyntaxWarning: invalid escape sequence '\\w'\n", + " warning_text = '\\warning DANGER'\n", + "/home/jeff/projects/JEPL/jepl/jepl_templates.py:51: SyntaxWarning: invalid escape sequence '\\B'\n", + " block_start_string = '\\BLOCK{',\n", + "/home/jeff/projects/JEPL/jepl/jepl_templates.py:53: SyntaxWarning: invalid escape sequence '\\V'\n", + " variable_start_string = '\\VAR((',\n", + "/home/jeff/projects/JEPL/jepl/jepl_templates.py:55: SyntaxWarning: invalid escape sequence '\\#'\n", + " comment_start_string = '\\#{',\n", + "/home/jeff/projects/JEPL/jepl/jepl_templates.py:104: SyntaxWarning: invalid escape sequence '\\w'\n", + " warning_text = '\\warning WARNING'\n", + "/home/jeff/projects/JEPL/jepl/jepl_templates.py:107: SyntaxWarning: invalid escape sequence '\\w'\n", + " warning_text = '\\warning DANGER'\n", + "/home/jeff/projects/JEPL/jepl/jepl_templates.py:137: SyntaxWarning: invalid escape sequence '\\B'\n", + " block_start_string = '\\BLOCK{',\n", + "/home/jeff/projects/JEPL/jepl/jepl_templates.py:139: SyntaxWarning: invalid escape sequence '\\V'\n", + " variable_start_string = '\\VAR((',\n", + "/home/jeff/projects/JEPL/jepl/jepl_templates.py:141: SyntaxWarning: invalid escape sequence '\\#'\n", + " comment_start_string = '\\#{',\n" + ] + }, + { + "ename": "FileNotFoundError", + "evalue": "[Errno 2] No such file or directory: 'JEPL/jepl/Tables/CEC-Tables/CEC21-table1.csv'", + "output_type": "error", + "traceback": [ + "\u001b[31m---------------------------------------------------------------------------\u001b[39m", + "\u001b[31mFileNotFoundError\u001b[39m Traceback (most recent call last)", + "\u001b[36mFile \u001b[39m\u001b[32m~/projects/JEPL/jepl/jeplinit.py:60\u001b[39m\n\u001b[32m 47\u001b[39m \u001b[33;03m'''\u001b[39;00m\n\u001b[32m 48\u001b[39m \u001b[33;03m This is all the tables and their sources that will be added to the databases.\u001b[39;00m\n\u001b[32m 49\u001b[39m \u001b[33;03m \u001b[39;00m\n\u001b[32m 50\u001b[39m \u001b[33;03m'''\u001b[39;00m\n\u001b[32m 52\u001b[39m CEC21_database = [\n\u001b[32m 53\u001b[39m [\u001b[33m'\u001b[39m\u001b[33mjepl-cec21.db\u001b[39m\u001b[33m'\u001b[39m,\u001b[33m'\u001b[39m\u001b[33mTable1\u001b[39m\u001b[33m'\u001b[39m,location+\u001b[33m'\u001b[39m\u001b[33mTables/CEC-Tables/CEC21-table1.csv\u001b[39m\u001b[33m'\u001b[39m],\n\u001b[32m 54\u001b[39m [\u001b[33m'\u001b[39m\u001b[33mjepl-cec21.db\u001b[39m\u001b[33m'\u001b[39m,\u001b[33m'\u001b[39m\u001b[33mTable2\u001b[39m\u001b[33m'\u001b[39m,location+\u001b[33m'\u001b[39m\u001b[33mTables/CEC-Tables/CEC21-table2.csv\u001b[39m\u001b[33m'\u001b[39m],\n\u001b[32m (...)\u001b[39m\u001b[32m 58\u001b[39m [\u001b[33m'\u001b[39m\u001b[33mjepl-cec21.db\u001b[39m\u001b[33m'\u001b[39m,\u001b[33m'\u001b[39m\u001b[33mTable16\u001b[39m\u001b[33m'\u001b[39m,location+\u001b[33m'\u001b[39m\u001b[33mTables/CEC-Tables/CEC21-table16.csv\u001b[39m\u001b[33m'\u001b[39m],\n\u001b[32m 59\u001b[39m ]\n\u001b[32m---> \u001b[39m\u001b[32m60\u001b[39m \u001b[43mcreate_database\u001b[49m\u001b[43m(\u001b[49m\u001b[33;43m'\u001b[39;49m\u001b[33;43mjepl-cec21.db\u001b[39;49m\u001b[33;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43mCEC21_database\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 62\u001b[39m Z46215_database = [\n\u001b[32m 63\u001b[39m [\u001b[33m'\u001b[39m\u001b[33mjepl-z46215.db\u001b[39m\u001b[33m'\u001b[39m,\u001b[33m'\u001b[39m\u001b[33mTable1A\u001b[39m\u001b[33m'\u001b[39m,location+\u001b[33m'\u001b[39m\u001b[33mTables/Z462-Tables/Z46215-table1A.csv\u001b[39m\u001b[33m'\u001b[39m],\n\u001b[32m 64\u001b[39m [\u001b[33m'\u001b[39m\u001b[33mjepl-z46215.db\u001b[39m\u001b[33m'\u001b[39m,\u001b[33m'\u001b[39m\u001b[33mTable1B\u001b[39m\u001b[33m'\u001b[39m,location+\u001b[33m'\u001b[39m\u001b[33mTables/Z462-Tables/Z46215-table1B.csv\u001b[39m\u001b[33m'\u001b[39m],\n\u001b[32m 65\u001b[39m ]\n\u001b[32m 66\u001b[39m create_database(\u001b[33m'\u001b[39m\u001b[33mjepl-z46215.db\u001b[39m\u001b[33m'\u001b[39m,Z46215_database)\n", + "\u001b[36mFile \u001b[39m\u001b[32m~/projects/JEPL/jepl/jeplinit.py:42\u001b[39m, in \u001b[36mcreate_database\u001b[39m\u001b[34m(name, tables)\u001b[39m\n\u001b[32m 40\u001b[39m table = tables[i][\u001b[32m1\u001b[39m]\n\u001b[32m 41\u001b[39m source = tables[i][\u001b[32m2\u001b[39m]\n\u001b[32m---> \u001b[39m\u001b[32m42\u001b[39m data = \u001b[43mpd\u001b[49m\u001b[43m.\u001b[49m\u001b[43mread_csv\u001b[49m\u001b[43m(\u001b[49m\u001b[43msource\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 44\u001b[39m insert(db,table,data)\n", + "\u001b[36mFile \u001b[39m\u001b[32m~/projects/JEPL/.venv/lib/python3.12/site-packages/pandas/io/parsers/readers.py:1026\u001b[39m, in \u001b[36mread_csv\u001b[39m\u001b[34m(filepath_or_buffer, sep, delimiter, header, names, index_col, usecols, dtype, engine, converters, true_values, false_values, skipinitialspace, skiprows, skipfooter, nrows, na_values, keep_default_na, na_filter, verbose, skip_blank_lines, parse_dates, infer_datetime_format, keep_date_col, date_parser, date_format, dayfirst, cache_dates, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, doublequote, escapechar, comment, encoding, encoding_errors, dialect, on_bad_lines, delim_whitespace, low_memory, memory_map, float_precision, storage_options, dtype_backend)\u001b[39m\n\u001b[32m 1013\u001b[39m kwds_defaults = _refine_defaults_read(\n\u001b[32m 1014\u001b[39m dialect,\n\u001b[32m 1015\u001b[39m delimiter,\n\u001b[32m (...)\u001b[39m\u001b[32m 1022\u001b[39m dtype_backend=dtype_backend,\n\u001b[32m 1023\u001b[39m )\n\u001b[32m 1024\u001b[39m kwds.update(kwds_defaults)\n\u001b[32m-> \u001b[39m\u001b[32m1026\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43m_read\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfilepath_or_buffer\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mkwds\u001b[49m\u001b[43m)\u001b[49m\n", + "\u001b[36mFile \u001b[39m\u001b[32m~/projects/JEPL/.venv/lib/python3.12/site-packages/pandas/io/parsers/readers.py:620\u001b[39m, in \u001b[36m_read\u001b[39m\u001b[34m(filepath_or_buffer, kwds)\u001b[39m\n\u001b[32m 617\u001b[39m _validate_names(kwds.get(\u001b[33m\"\u001b[39m\u001b[33mnames\u001b[39m\u001b[33m\"\u001b[39m, \u001b[38;5;28;01mNone\u001b[39;00m))\n\u001b[32m 619\u001b[39m \u001b[38;5;66;03m# Create the parser.\u001b[39;00m\n\u001b[32m--> \u001b[39m\u001b[32m620\u001b[39m parser = \u001b[43mTextFileReader\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfilepath_or_buffer\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m*\u001b[49m\u001b[43m*\u001b[49m\u001b[43mkwds\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 622\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m chunksize \u001b[38;5;129;01mor\u001b[39;00m iterator:\n\u001b[32m 623\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m parser\n", + "\u001b[36mFile \u001b[39m\u001b[32m~/projects/JEPL/.venv/lib/python3.12/site-packages/pandas/io/parsers/readers.py:1620\u001b[39m, in \u001b[36mTextFileReader.__init__\u001b[39m\u001b[34m(self, f, engine, **kwds)\u001b[39m\n\u001b[32m 1617\u001b[39m \u001b[38;5;28mself\u001b[39m.options[\u001b[33m\"\u001b[39m\u001b[33mhas_index_names\u001b[39m\u001b[33m\"\u001b[39m] = kwds[\u001b[33m\"\u001b[39m\u001b[33mhas_index_names\u001b[39m\u001b[33m\"\u001b[39m]\n\u001b[32m 1619\u001b[39m \u001b[38;5;28mself\u001b[39m.handles: IOHandles | \u001b[38;5;28;01mNone\u001b[39;00m = \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[32m-> \u001b[39m\u001b[32m1620\u001b[39m \u001b[38;5;28mself\u001b[39m._engine = \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_make_engine\u001b[49m\u001b[43m(\u001b[49m\u001b[43mf\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43mengine\u001b[49m\u001b[43m)\u001b[49m\n", + "\u001b[36mFile \u001b[39m\u001b[32m~/projects/JEPL/.venv/lib/python3.12/site-packages/pandas/io/parsers/readers.py:1880\u001b[39m, in \u001b[36mTextFileReader._make_engine\u001b[39m\u001b[34m(self, f, engine)\u001b[39m\n\u001b[32m 1878\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m \u001b[33m\"\u001b[39m\u001b[33mb\u001b[39m\u001b[33m\"\u001b[39m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m mode:\n\u001b[32m 1879\u001b[39m mode += \u001b[33m\"\u001b[39m\u001b[33mb\u001b[39m\u001b[33m\"\u001b[39m\n\u001b[32m-> \u001b[39m\u001b[32m1880\u001b[39m \u001b[38;5;28mself\u001b[39m.handles = \u001b[43mget_handle\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 1881\u001b[39m \u001b[43m \u001b[49m\u001b[43mf\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1882\u001b[39m \u001b[43m \u001b[49m\u001b[43mmode\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1883\u001b[39m \u001b[43m \u001b[49m\u001b[43mencoding\u001b[49m\u001b[43m=\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43moptions\u001b[49m\u001b[43m.\u001b[49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mencoding\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1884\u001b[39m \u001b[43m \u001b[49m\u001b[43mcompression\u001b[49m\u001b[43m=\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43moptions\u001b[49m\u001b[43m.\u001b[49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mcompression\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1885\u001b[39m \u001b[43m \u001b[49m\u001b[43mmemory_map\u001b[49m\u001b[43m=\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43moptions\u001b[49m\u001b[43m.\u001b[49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mmemory_map\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1886\u001b[39m \u001b[43m \u001b[49m\u001b[43mis_text\u001b[49m\u001b[43m=\u001b[49m\u001b[43mis_text\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1887\u001b[39m \u001b[43m \u001b[49m\u001b[43merrors\u001b[49m\u001b[43m=\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43moptions\u001b[49m\u001b[43m.\u001b[49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mencoding_errors\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mstrict\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1888\u001b[39m \u001b[43m \u001b[49m\u001b[43mstorage_options\u001b[49m\u001b[43m=\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43moptions\u001b[49m\u001b[43m.\u001b[49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mstorage_options\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1889\u001b[39m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 1890\u001b[39m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;28mself\u001b[39m.handles \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[32m 1891\u001b[39m f = \u001b[38;5;28mself\u001b[39m.handles.handle\n", + "\u001b[36mFile \u001b[39m\u001b[32m~/projects/JEPL/.venv/lib/python3.12/site-packages/pandas/io/common.py:873\u001b[39m, in \u001b[36mget_handle\u001b[39m\u001b[34m(path_or_buf, mode, encoding, compression, memory_map, is_text, errors, storage_options)\u001b[39m\n\u001b[32m 868\u001b[39m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(handle, \u001b[38;5;28mstr\u001b[39m):\n\u001b[32m 869\u001b[39m \u001b[38;5;66;03m# Check whether the filename is to be opened in binary mode.\u001b[39;00m\n\u001b[32m 870\u001b[39m \u001b[38;5;66;03m# Binary mode does not support 'encoding' and 'newline'.\u001b[39;00m\n\u001b[32m 871\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m ioargs.encoding \u001b[38;5;129;01mand\u001b[39;00m \u001b[33m\"\u001b[39m\u001b[33mb\u001b[39m\u001b[33m\"\u001b[39m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m ioargs.mode:\n\u001b[32m 872\u001b[39m \u001b[38;5;66;03m# Encoding\u001b[39;00m\n\u001b[32m--> \u001b[39m\u001b[32m873\u001b[39m handle = \u001b[38;5;28;43mopen\u001b[39;49m\u001b[43m(\u001b[49m\n\u001b[32m 874\u001b[39m \u001b[43m \u001b[49m\u001b[43mhandle\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 875\u001b[39m \u001b[43m \u001b[49m\u001b[43mioargs\u001b[49m\u001b[43m.\u001b[49m\u001b[43mmode\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 876\u001b[39m \u001b[43m \u001b[49m\u001b[43mencoding\u001b[49m\u001b[43m=\u001b[49m\u001b[43mioargs\u001b[49m\u001b[43m.\u001b[49m\u001b[43mencoding\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 877\u001b[39m \u001b[43m \u001b[49m\u001b[43merrors\u001b[49m\u001b[43m=\u001b[49m\u001b[43merrors\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 878\u001b[39m \u001b[43m \u001b[49m\u001b[43mnewline\u001b[49m\u001b[43m=\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[32m 879\u001b[39m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 880\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[32m 881\u001b[39m \u001b[38;5;66;03m# Binary mode\u001b[39;00m\n\u001b[32m 882\u001b[39m handle = \u001b[38;5;28mopen\u001b[39m(handle, ioargs.mode)\n", + "\u001b[31mFileNotFoundError\u001b[39m: [Errno 2] No such file or directory: 'JEPL/jepl/Tables/CEC-Tables/CEC21-table1.csv'" + ] + } + ], "source": [ - "import JEPL.jepl.jepl as jmk\n", - "%run JEPL/jepl/jeplinit.py JEPL/jepl/ " + "import jepl.jepl as jmk\n", + "%run jepl/jeplinit.py JEPL/jepl/ " ] }, { @@ -915,7 +959,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": ".venv", "language": "python", "name": "python3" }, @@ -929,7 +973,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.1" + "version": "3.12.12" } }, "nbformat": 4, diff --git a/jepl/Tables/CEC21Tables.py b/jepl/Tables/CEC21Tables.py new file mode 100644 index 0000000..31a10d4 --- /dev/null +++ b/jepl/Tables/CEC21Tables.py @@ -0,0 +1,33 @@ + +# CEC 2021, Table 1 + +table1 = [ + #['size', '60', '75', '90'], + ['14', 25, 30, 35], + ['12', 30, 35, 40], + ['10', 40, 50, 55], + ['8', 60, 70,80], + ['6', 80, 95, 105], + ['4', 105, 125, 140], + ['3', 120, 145, 165], + ['2', 140, 170, 190], + ['1', 165, 195, 220], + ['1/0', 195, 230, 260], + ['2/0', 220, 265, 300], + ['3/0', 260, 310, 350], + ['4/0', 300, 360, 405], + ['250', 340, 405, 455], + ['300', 370, 445, 500], + ['350', 425, 505, 570], + ['400', 455, 545, 615], + ['500', 520, 620, 700], + ['600', 580, 690, 780], + ['700', 630, 755, 850], + ['750', 655, 785, 885], + ['800', 680, 815, 920], + ['1000', 785, 870, 980], + ['1250', 890, 1065, 1200], + ['1500', 985, 1175, 1325], + ['1750', 1070, 1280, 1445], + ['2000', 1160, 1385, 1560] + ] \ No newline at end of file diff --git a/jepl/jepl_circuits.py b/jepl/jepl_circuits.py index 361bc68..5724da0 100644 --- a/jepl/jepl_circuits.py +++ b/jepl/jepl_circuits.py @@ -11,6 +11,7 @@ import pandas as pd import numpy as np import math import sqlite3 +import bisect def vd(current,length,resistance,runs=1): @@ -235,8 +236,26 @@ def conductor_size(current, temp = 75, material = 'cu', code = 'CEC', raceway = if load_type in list_125: current = 1.25 * current + # Seclect the proper table + + if (code == 'CEC'): + import Tables.CEC21Tables + + if (material == 'CU') & (raceway == False): + table = table1 + + + elif (material == 'CU') & (raceway == True): + table = table3 + + # Determine the ampacity of the max conductor size + + + # select the correct code table - if (code == 'CEC') & (material == 'CU') & (raceway == False): # CEC Table 1 + if (code == 'CEC'): # CEC Table 1 + + try: with sqlite3.connect("jepl-cec21.db") as con: cur = con.cursor()