pjdev-sqlmodel 4.3.2__tar.gz → 4.3.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pjdev-sqlmodel
3
- Version: 4.3.2
3
+ Version: 4.3.4
4
4
  Project-URL: Documentation, https://gitlab.purplejay.net/keystone/python
5
5
  Project-URL: Issues, https://gitlab.purplejay.net/keystone/python/issues
6
6
  Project-URL: Source, https://gitlab.purplejay.net/keystone/python
@@ -1,4 +1,4 @@
1
1
  # SPDX-FileCopyrightText: 2024-present Chris O'Neill <chris@purplejay.io>
2
2
  #
3
3
  # SPDX-License-Identifier: MIT
4
- __version__ = "4.3.2"
4
+ __version__ = "4.3.4"
@@ -3,6 +3,10 @@ import warnings
3
3
  from pathlib import Path
4
4
  from typing import Type, TypeVar, List, Optional, Tuple, Dict
5
5
 
6
+ from openpyxl.styles import Font, Alignment
7
+ from openpyxl.utils import get_column_letter
8
+ from openpyxl.utils.dataframe import dataframe_to_rows
9
+ from openpyxl.workbook import Workbook
6
10
  from pydantic import ValidationError, BaseModel
7
11
  import pandas as pd
8
12
  from openpyxl.reader.excel import load_workbook
@@ -34,12 +38,14 @@ def get_csv_columns(file_path):
34
38
  return header
35
39
 
36
40
 
37
- def get_excel_columns(file_path, header_ndx: int = 1, col_range: Optional[str] = None):
41
+ def get_excel_columns(file_path, header_ndx: int = 1, col_range: Optional[str] = None, sheet_name: str | int = 0):
38
42
  with warnings.catch_warnings():
39
43
  warnings.filterwarnings("ignore")
40
44
  wb = load_workbook(filename=file_path, read_only=True)
41
45
 
42
- sheet = wb.active
46
+
47
+ # TODO: need to ensure that sending an int will work
48
+ sheet = wb[sheet_name] if sheet_name else wb.active
43
49
 
44
50
  if col_range is not None:
45
51
  return [c.value for c in [row for row in sheet[col_range]][0]]
@@ -95,7 +101,7 @@ def load_excel_data(
95
101
  for f in data_files
96
102
  if f.name.endswith(".xlsx")
97
103
  and len(
98
- set(cols).difference(set(get_excel_columns(f, header_ndx + 1, col_range)))
104
+ set(cols).difference(set(get_excel_columns(f, header_ndx + 1, col_range, sheet_name=sheet_name)))
99
105
  )
100
106
  == 0
101
107
  ]
File without changes