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

Add old_index_value to index_sql #88

Merged
merged 2 commits into from
Jan 24, 2025
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
3 changes: 1 addition & 2 deletions druzhba/mssql.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

import pymssql

from druzhba.config import CONFIG_DIR
from druzhba.table import TableConfig, load_query
from druzhba.table import TableConfig
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i removed these imports because the linter was complaining about them.



class MSSQLTableConfig(TableConfig):
Expand Down
3 changes: 1 addition & 2 deletions druzhba/mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
import pymysql.cursors
from pymysql import FIELD_TYPE as ft

from druzhba.config import CONFIG_DIR
from druzhba.table import TableConfig, load_query
from druzhba.table import TableConfig


class MysqlTypes:
Expand Down
3 changes: 1 addition & 2 deletions druzhba/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
import psycopg2.extensions
import psycopg2.extras

from druzhba.config import CONFIG_DIR
from druzhba.table import TableConfig, load_query
from druzhba.table import TableConfig

psycopg2.extensions.register_type(psycopg2.extensions.UNICODE)
psycopg2.extensions.register_type(psycopg2.extensions.UNICODEARRAY)
Expand Down
9 changes: 7 additions & 2 deletions druzhba/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,12 @@ def run_template_data(self):
"old_index_value": self.old_index_value,
}

@property
def index_template_data(self):
return {
"old_index_value": self.old_index_value
}

def _load_old_index_value(self):
"""Sets and gets the index_value property, retrieved from Redshift

Expand Down Expand Up @@ -660,8 +666,7 @@ def new_index_value(self):
query = template.render(
db=self.db_template_data,
table=self.table_template_data,
# Cannot include the run template data
# here because we do not know the index values yet
index=self.index_template_data,
)
self._new_index_value = self.query_fetchone(query)["index_value"]

Expand Down
Loading