Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/__slots__ #23

Merged
merged 3 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pydbsmgr/fast_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
class DataFrameToSQL(ColumnsCheck):
"""Allows you to create a table from a dataframe"""

__slots__ = ["_connection_string", "_con", "_cur"]

def __init__(self, connection_string: str) -> None:
"""Set the connection with the database"""
self._connection_string = connection_string
Expand Down
5 changes: 4 additions & 1 deletion pydbsmgr/lightest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import concurrent.futures
from functools import partial
from functools import cached_property, partial

from pydbsmgr.main import *
from pydbsmgr.utils.tools import coerce_datetime, most_repeated_item
Expand Down Expand Up @@ -42,6 +42,9 @@ def process_dates(x: str, format_type: str, auxiliary_type: str) -> str:
class LightCleaner:
"""Performs a light cleaning on the table"""

# Increase memory efficiency
__slots__ = ["df", "dict_dtypes"]

def __init__(self, df_: DataFrame):
self.df = df_.copy()
self.dict_dtypes = dict(zip(["float", "int", "str"], ["float64", "int64", "object"]))
Expand Down