contact-person-profile-csv-imp-local 0.0.38__tar.gz → 0.0.40__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.
- {contact_person_profile_csv_imp_local-0.0.38 → contact_person_profile_csv_imp_local-0.0.40}/PKG-INFO +1 -1
- {contact_person_profile_csv_imp_local-0.0.38 → contact_person_profile_csv_imp_local-0.0.40}/contact_person_profile_csv_imp_local/src/CSVToContactPersonProfile.py +36 -18
- {contact_person_profile_csv_imp_local-0.0.38 → contact_person_profile_csv_imp_local-0.0.40}/contact_person_profile_csv_imp_local.egg-info/PKG-INFO +1 -1
- {contact_person_profile_csv_imp_local-0.0.38 → contact_person_profile_csv_imp_local-0.0.40}/setup.py +1 -1
- {contact_person_profile_csv_imp_local-0.0.38 → contact_person_profile_csv_imp_local-0.0.40}/README.md +0 -0
- {contact_person_profile_csv_imp_local-0.0.38 → contact_person_profile_csv_imp_local-0.0.40}/contact_person_profile_csv_imp_local/src/__init__.py +0 -0
- {contact_person_profile_csv_imp_local-0.0.38 → contact_person_profile_csv_imp_local-0.0.40}/contact_person_profile_csv_imp_local/src/contact_person_profile_csv_imp_local_constants.py +0 -0
- {contact_person_profile_csv_imp_local-0.0.38 → contact_person_profile_csv_imp_local-0.0.40}/contact_person_profile_csv_imp_local.egg-info/SOURCES.txt +0 -0
- {contact_person_profile_csv_imp_local-0.0.38 → contact_person_profile_csv_imp_local-0.0.40}/contact_person_profile_csv_imp_local.egg-info/dependency_links.txt +0 -0
- {contact_person_profile_csv_imp_local-0.0.38 → contact_person_profile_csv_imp_local-0.0.40}/contact_person_profile_csv_imp_local.egg-info/requires.txt +0 -0
- {contact_person_profile_csv_imp_local-0.0.38 → contact_person_profile_csv_imp_local-0.0.40}/contact_person_profile_csv_imp_local.egg-info/top_level.txt +0 -0
- {contact_person_profile_csv_imp_local-0.0.38 → contact_person_profile_csv_imp_local-0.0.40}/pyproject.toml +0 -0
- {contact_person_profile_csv_imp_local-0.0.38 → contact_person_profile_csv_imp_local-0.0.40}/setup.cfg +0 -0
{contact_person_profile_csv_imp_local-0.0.38 → contact_person_profile_csv_imp_local-0.0.40}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: contact-person-profile-csv-imp-local
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.40
|
|
4
4
|
Summary: PyPI Package for Circles CSVToContactPersonProfile-local Local/Remote Python
|
|
5
5
|
Home-page: https://github.com/circles-zone/contact-person-profile-csv-imp-local-python-package
|
|
6
6
|
Author: Circles
|
|
@@ -173,10 +173,11 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
173
173
|
# TODO Align the parameters between import-contact-csv with sync-google-contact
|
|
174
174
|
# TODO Can we please add groups_str parameter to both sync-google-contact and import-contact-csv where we add all contacts to those groups?
|
|
175
175
|
def insert_update_contact_from_csv(
|
|
176
|
-
|
|
176
|
+
# TODO username -> user_external_username
|
|
177
|
+
self, *, username: str, email_address: str, data_source_type_id: int, file_name: str = None, system_id: int = None,
|
|
177
178
|
# TODO Add support to criteria_set_id
|
|
178
179
|
directory_name: str = None, csv_path: str = None, start_index: int = 0, end_index: int = None,
|
|
179
|
-
groups_dicts: list[dict] = None
|
|
180
|
+
groups_dicts: list[dict] = None) -> dict:
|
|
180
181
|
"""
|
|
181
182
|
Insert contacts from CSV file to the database
|
|
182
183
|
:param data_source_type_id: The data source id
|
|
@@ -193,13 +194,15 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
193
194
|
:return:
|
|
194
195
|
"""
|
|
195
196
|
data_source_type_name = DataSources().get_data_source_name_by_id(data_source_type_id)
|
|
196
|
-
|
|
197
|
+
profile_id = ProfilesLocal().select_one_value_by_column_and_value(
|
|
197
198
|
schema_name="profile", view_table_name="profile_view",
|
|
198
199
|
select_clause_value="profile_id", column_name="profile.main_email_address",
|
|
199
|
-
column_value=
|
|
200
|
+
column_value=email_address)
|
|
201
|
+
if profile_id is None:
|
|
202
|
+
self.logger.error("Couldn't find profile_id in profile_view by email_address.")
|
|
203
|
+
raise Exception("Couldn't find profile_id in profile_view by email_address.")
|
|
200
204
|
system_id = system_id or CONTACT_PERSON_PROFILE_CSV_SYSTEM_ID
|
|
201
205
|
self.set_schema(schema_name="field")
|
|
202
|
-
profile_id = profile_id or profile_id_by_email_address
|
|
203
206
|
self.groups_list = groups_dicts if groups_dicts else []
|
|
204
207
|
'''
|
|
205
208
|
profile_id = ProfilesLocal().select_one_value_by_column_and_value(
|
|
@@ -229,13 +232,13 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
229
232
|
'address1_country', 'address2_street', 'address2_city', 'address2_state', 'address2_postal_code',
|
|
230
233
|
'address2_country', 'job_title', 'organization', 'display_as')
|
|
231
234
|
|
|
232
|
-
user_external_id = self.__get_user_external_id(user_external_username=
|
|
235
|
+
user_external_id = self.__get_user_external_id(user_external_username=username,
|
|
233
236
|
profile_id=profile_id, system_id=system_id)
|
|
234
237
|
# We create a new data_source_instance_id everytime we import a new csv file
|
|
235
238
|
data_source_instance_id = self.__get_data_source_instance_id(
|
|
236
239
|
data_source_type_id=data_source_type_id, csv_file_path=csv_file_path,
|
|
237
240
|
user_external_id=user_external_id, file_name=file_name,
|
|
238
|
-
user_external_username=
|
|
241
|
+
user_external_username=username,
|
|
239
242
|
start_index=start_index, end_index=end_index
|
|
240
243
|
)
|
|
241
244
|
fields_dictonary = self.data_sources.get_fields_name_from_csv(data_source_type_id)
|
|
@@ -509,8 +512,8 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
509
512
|
|
|
510
513
|
def __insert_link_contact_groups(self, contact_dict: dict) -> list:
|
|
511
514
|
contact_id = contact_dict.get("contact_id")
|
|
512
|
-
|
|
513
|
-
|
|
515
|
+
groups_dicts_list = []
|
|
516
|
+
linked_groups_results_list = []
|
|
514
517
|
organization = contact_dict.get("organization")
|
|
515
518
|
if organization:
|
|
516
519
|
organization_group_dict = {
|
|
@@ -523,7 +526,7 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
523
526
|
"is_main_title": False,
|
|
524
527
|
"title": organization,
|
|
525
528
|
}
|
|
526
|
-
|
|
529
|
+
groups_dicts_list.append(organization_group_dict)
|
|
527
530
|
job_title = contact_dict.get("job_title")
|
|
528
531
|
if job_title:
|
|
529
532
|
job_title_group_dict = {
|
|
@@ -536,27 +539,30 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
536
539
|
"is_main_title": False,
|
|
537
540
|
"title": job_title,
|
|
538
541
|
}
|
|
539
|
-
|
|
542
|
+
groups_dicts_list.append(job_title_group_dict)
|
|
540
543
|
if contact_dict.get("groups"):
|
|
544
|
+
# TODO _contacts_groups_names_list?
|
|
541
545
|
_groups = contact_dict.get("groups").split(", ")
|
|
542
546
|
for group in _groups:
|
|
543
547
|
group_dict = {
|
|
544
548
|
# table:
|
|
545
|
-
"name": group,
|
|
549
|
+
"name": group, # TODO We need to translate to English
|
|
546
550
|
"hashtag": '#' + group.upper(),
|
|
547
551
|
"main_group_type_id": self.unknown_main_group_type_id,
|
|
548
552
|
# ml table:
|
|
553
|
+
# TODO What about the lang_code?
|
|
549
554
|
"is_main_title": False,
|
|
550
555
|
"title": group,
|
|
551
556
|
}
|
|
552
|
-
|
|
557
|
+
groups_dicts_list.append(group_dict)
|
|
553
558
|
for group in self.groups_list:
|
|
554
|
-
|
|
555
|
-
if len(
|
|
556
|
-
|
|
557
|
-
contact_id=contact_id, groups_list_of_dicts=
|
|
559
|
+
groups_dicts_list.append(group)
|
|
560
|
+
if len(groups_dicts_list) > 0:
|
|
561
|
+
linked_groups_results_list = self.contact_groups.insert_link_contact_group_with_group_local(
|
|
562
|
+
contact_id=contact_id, groups_list_of_dicts=groups_dicts_list)
|
|
563
|
+
contact_dict["linked_group_results_list"] = linked_groups_results_list
|
|
558
564
|
|
|
559
|
-
return
|
|
565
|
+
return linked_groups_results_list
|
|
560
566
|
|
|
561
567
|
def __insert_link_contact_persons(self, contact_dict: dict) -> dict:
|
|
562
568
|
if not contact_dict.get("first_name") and not contact_dict.get("last_name"):
|
|
@@ -793,6 +799,8 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
793
799
|
proccessed_location_dicts.append(current_location_dict)
|
|
794
800
|
for email_address in email_addresses_list:
|
|
795
801
|
country = Country.get_country_name_by_email_address(email_address)
|
|
802
|
+
if country is None:
|
|
803
|
+
continue
|
|
796
804
|
current_location_dict = {
|
|
797
805
|
"address_local_language": None,
|
|
798
806
|
"city": None,
|
|
@@ -862,6 +870,16 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
862
870
|
user_external_id = self.user_externals_local.select_one_value_by_column_and_value(
|
|
863
871
|
select_clause_value="user_external_id", column_name="username",
|
|
864
872
|
column_value=user_external_username, order_by="user_external_id DESC")
|
|
873
|
+
if user_external_id is None:
|
|
874
|
+
self.logger.error("Couldn't find user_external_id in user_external by username.")
|
|
875
|
+
raise Exception("Couldn't find user_external_id in user_external by username.")
|
|
876
|
+
# TODO: Why do we have profile_user_external schema? user_external_table already has profile_id
|
|
877
|
+
profile_user_external_data_dict = {"profile_id": profile_id, "user_external_id": user_external_id}
|
|
878
|
+
profile_user_external_id = self.insert_if_not_exists(
|
|
879
|
+
schema_name="profile_user_external", table_name="profile_user_external_table",
|
|
880
|
+
view_table_name="profile_user_external_view", data_dict=profile_user_external_data_dict,
|
|
881
|
+
data_dict_compare=profile_user_external_data_dict
|
|
882
|
+
)
|
|
865
883
|
|
|
866
884
|
return user_external_id
|
|
867
885
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: contact-person-profile-csv-imp-local
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.40
|
|
4
4
|
Summary: PyPI Package for Circles CSVToContactPersonProfile-local Local/Remote Python
|
|
5
5
|
Home-page: https://github.com/circles-zone/contact-person-profile-csv-imp-local-python-package
|
|
6
6
|
Author: Circles
|
{contact_person_profile_csv_imp_local-0.0.38 → contact_person_profile_csv_imp_local-0.0.40}/setup.py
RENAMED
|
@@ -5,7 +5,7 @@ package_dir = PACKAGE_NAME.replace("-", "_")
|
|
|
5
5
|
|
|
6
6
|
setuptools.setup(
|
|
7
7
|
name=PACKAGE_NAME,
|
|
8
|
-
version='0.0.
|
|
8
|
+
version='0.0.40', # https://pypi.org/project/contact-person-profile-csv-imp-local/
|
|
9
9
|
author="Circles",
|
|
10
10
|
author_email="info@circles.ai",
|
|
11
11
|
description="PyPI Package for Circles CSVToContactPersonProfile-local Local/Remote Python",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|