|
24 | 24 |
|
25 | 25 | from databuilder.publisher.base_publisher import Publisher
|
26 | 26 | from databuilder.publisher.neo4j_preprocessor import NoopRelationPreprocessor
|
| 27 | +from databuilder.publisher.publisher_config_constants import ( |
| 28 | + Neo4jCsvPublisherConfigs, PublishBehaviorConfigs, PublisherConfigs, |
| 29 | +) |
27 | 30 |
|
28 | 31 | # Setting field_size_limit to solve the error below
|
29 | 32 | # _csv.Error: field larger than field limit (131072)
|
|
32 | 35 |
|
33 | 36 | # Config keys
|
34 | 37 | # A directory that contains CSV files for nodes
|
35 |
| -NODE_FILES_DIR = 'node_files_directory' |
| 38 | +NODE_FILES_DIR = PublisherConfigs.NODE_FILES_DIR |
36 | 39 | # A directory that contains CSV files for relationships
|
37 |
| -RELATION_FILES_DIR = 'relation_files_directory' |
| 40 | +RELATION_FILES_DIR = PublisherConfigs.RELATION_FILES_DIR |
38 | 41 | # A end point for Neo4j e.g: bolt://localhost:9999
|
39 |
| -NEO4J_END_POINT_KEY = 'neo4j_endpoint' |
| 42 | +NEO4J_END_POINT_KEY = Neo4jCsvPublisherConfigs.NEO4J_END_POINT_KEY |
40 | 43 | # A transaction size that determines how often it commits.
|
41 |
| -NEO4J_TRANSACTION_SIZE = 'neo4j_transaction_size' |
| 44 | +NEO4J_TRANSACTION_SIZE = Neo4jCsvPublisherConfigs.NEO4J_TRANSACTION_SIZE |
42 | 45 | # A progress report frequency that determines how often it report the progress.
|
43 | 46 | NEO4J_PROGRESS_REPORT_FREQUENCY = 'neo4j_progress_report_frequency'
|
44 | 47 | # A boolean flag to make it fail if relationship is not created
|
45 | 48 | NEO4J_RELATIONSHIP_CREATION_CONFIRM = 'neo4j_relationship_creation_confirm'
|
46 | 49 |
|
47 |
| -NEO4J_MAX_CONN_LIFE_TIME_SEC = 'neo4j_max_conn_life_time_sec' |
| 50 | +NEO4J_MAX_CONN_LIFE_TIME_SEC = Neo4jCsvPublisherConfigs.NEO4J_MAX_CONN_LIFE_TIME_SEC |
48 | 51 |
|
49 | 52 | # list of nodes that are create only, and not updated if match exists
|
50 |
| -NEO4J_CREATE_ONLY_NODES = 'neo4j_create_only_nodes' |
| 53 | +NEO4J_CREATE_ONLY_NODES = Neo4jCsvPublisherConfigs.NEO4J_CREATE_ONLY_NODES |
51 | 54 |
|
52 | 55 | # list of node labels that could attempt to be accessed simultaneously
|
53 | 56 | NEO4J_DEADLOCK_NODE_LABELS = 'neo4j_deadlock_node_labels'
|
54 | 57 |
|
55 |
| -NEO4J_USER = 'neo4j_user' |
56 |
| -NEO4J_PASSWORD = 'neo4j_password' |
| 58 | +NEO4J_USER = Neo4jCsvPublisherConfigs.NEO4J_USER |
| 59 | +NEO4J_PASSWORD = Neo4jCsvPublisherConfigs.NEO4J_PASSWORD |
57 | 60 | # in Neo4j (v4.0+), we can create and use more than one active database at the same time
|
58 |
| -NEO4J_DATABASE_NAME = 'neo4j_database' |
| 61 | +NEO4J_DATABASE_NAME = Neo4jCsvPublisherConfigs.NEO4J_DATABASE_NAME |
59 | 62 |
|
60 | 63 | # NEO4J_ENCRYPTED is a boolean indicating whether to use SSL/TLS when connecting
|
61 |
| -NEO4J_ENCRYPTED = 'neo4j_encrypted' |
| 64 | +NEO4J_ENCRYPTED = Neo4jCsvPublisherConfigs.NEO4J_ENCRYPTED |
62 | 65 | # NEO4J_VALIDATE_SSL is a boolean indicating whether to validate the server's SSL/TLS
|
63 | 66 | # cert against system CAs
|
64 |
| -NEO4J_VALIDATE_SSL = 'neo4j_validate_ssl' |
| 67 | +NEO4J_VALIDATE_SSL = Neo4jCsvPublisherConfigs.NEO4J_VALIDATE_SSL |
65 | 68 |
|
66 | 69 | # This will be used to provide unique tag to the node and relationship
|
67 |
| -JOB_PUBLISH_TAG = 'job_publish_tag' |
| 70 | +JOB_PUBLISH_TAG = PublisherConfigs.JOB_PUBLISH_TAG |
68 | 71 |
|
69 | 72 | # any additional fields that should be added to nodes and rels through config
|
70 |
| -ADDITIONAL_FIELDS = 'additional_fields' |
| 73 | +ADDITIONAL_FIELDS = PublisherConfigs.ADDITIONAL_PUBLISHER_METADATA_FIELDS |
71 | 74 |
|
72 | 75 | # Neo4j property name for published tag
|
73 |
| -PUBLISHED_TAG_PROPERTY_NAME = 'published_tag' |
| 76 | +PUBLISHED_TAG_PROPERTY_NAME = PublisherConfigs.PUBLISHED_TAG_PROPERTY_NAME |
74 | 77 |
|
75 | 78 | # Neo4j property name for last updated timestamp
|
76 |
| -LAST_UPDATED_EPOCH_MS = 'publisher_last_updated_epoch_ms' |
| 79 | +LAST_UPDATED_EPOCH_MS = PublisherConfigs.LAST_UPDATED_EPOCH_MS |
77 | 80 |
|
78 | 81 | # A boolean flag to indicate if publisher_metadata (e.g. published_tag,
|
79 | 82 | # publisher_last_updated_epoch_ms)
|
80 | 83 | # will be included as properties of the Neo4j nodes
|
81 |
| -ADD_PUBLISHER_METADATA = 'add_publisher_metadata' |
| 84 | +ADD_PUBLISHER_METADATA = PublishBehaviorConfigs.ADD_PUBLISHER_METADATA |
82 | 85 |
|
83 | 86 | RELATION_PREPROCESSOR = 'relation_preprocessor'
|
84 | 87 |
|
|
0 commit comments