lidb 1.1.0__tar.gz → 1.1.2__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.

Potentially problematic release.


This version of lidb might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lidb
3
- Version: 1.1.0
3
+ Version: 1.1.2
4
4
  Requires-Python: >=3.12
5
5
  Description-Content-Type: text/markdown
6
6
  Requires-Dist: dynaconf>=3.2.11
@@ -15,8 +15,9 @@ from .database import (
15
15
  tb_path,
16
16
  read_mysql,
17
17
  read_ck,
18
+ scan,
18
19
  )
19
20
 
20
21
  from .parse import parse_hive_partition_structure
21
22
 
22
- __version__ = "1.1.0"
23
+ __version__ = "1.1.2"
@@ -12,6 +12,7 @@ from pathlib import Path
12
12
  from .parse import extract_table_names_from_sql
13
13
  from .init import DB_PATH, logger, get_settings
14
14
  import urllib
15
+ import polars as pl
15
16
 
16
17
  # ======================== 本地数据库 catdb ========================
17
18
  def tb_path(tb_name: str) -> Path:
@@ -111,6 +112,13 @@ def sql(query: str, abs_path: bool = False):
111
112
  new_query = pattern.sub(lambda m: convertor[m.group(0)], query)
112
113
  return pl.sql(new_query)
113
114
 
115
+ def scan(tb: str, abs_path: bool = False) -> pl.LazyFrame:
116
+ """polars.scan_parquet"""
117
+
118
+ if not abs_path:
119
+ tb = tb_path(tb)
120
+ return pl.scan_parquet(tb)
121
+
114
122
  def read_mysql(query: str, db_conf: str = "DATABASES.mysql"):
115
123
  """
116
124
  从MySQL数据库中读取数据。
@@ -9,11 +9,8 @@ Email: yundi.xxii@outlook.com
9
9
  """
10
10
  import re
11
11
  from pathlib import Path
12
- from typing import Dict, Set
13
12
  from urllib.parse import unquote
14
- from collections import defaultdict
15
13
 
16
- import polars
17
14
  import polars as pl
18
15
  import sqlparse
19
16
 
@@ -72,7 +69,7 @@ def extract_table_names_from_sql(sql_query):
72
69
  return table_names
73
70
 
74
71
 
75
- def parse_hive_partition_structure(root_path: Path | str, file_pattern: str = "*.parquet") -> polars.DataFrame:
72
+ def parse_hive_partition_structure(root_path: Path | str, file_pattern: str = "*.parquet") -> pl.DataFrame:
76
73
  """
77
74
  通用Hive分区结构解析器
78
75
 
@@ -101,7 +98,7 @@ def parse_hive_partition_structure(root_path: Path | str, file_pattern: str = "*
101
98
  partition_dict[key] = value
102
99
 
103
100
  # 记录分区组合
104
- combination = tuple(sorted(partition_dict.items()))
101
+ combination = tuple(partition_dict.items())
105
102
  partition_combinations.add(combination)
106
103
 
107
104
  # 转换为普通dict
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lidb
3
- Version: 1.1.0
3
+ Version: 1.1.2
4
4
  Requires-Python: >=3.12
5
5
  Description-Content-Type: text/markdown
6
6
  Requires-Dist: dynaconf>=3.2.11
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "lidb"
3
- version = "1.1.0"
3
+ version = "1.1.2"
4
4
  description = ""
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes