-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinventory_load.py
More file actions
73 lines (66 loc) · 2.84 KB
/
inventory_load.py
File metadata and controls
73 lines (66 loc) · 2.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import os
import sys
import ldlite
ld = ldlite.LDLite()
ld.connect_folio(
url=os.environ['FOLIOURL'],
tenant=os.environ['FOLIOTENANT'],
user=os.environ['FOLIOUSER'],
password=os.environ['FOLIOPASSWORD'],
)
db = ld.connect_db_postgresql(dsn=f"""
dbname={os.environ['PGDATABASE']}
host={os.environ['PGHOST']}
port={os.environ['PGPORT']}
user={os.environ['PGUSER']}
password={os.environ['PGPASSWORD']}
""")
queries = [
('inventory.alternative_title_type', '/alternative-title-types'),
('inventory.call_number_type', '/call-number-types'),
('inventory.classification_type', '/classification-types'),
('inventory.contributor_name_type', '/contributor-name-types'),
('inventory.contributor_type', '/contributor-types'),
('inventory.electronic_access_relationship', '/electronic-access-relationships'),
('inventory.identifier_type', '/identifier-types'),
('inventory.ill_policy', '/ill-policies'),
('inventory.loan_type', '/loan-types'),
('inventory.location', '/locations'),
('inventory.loccampus', '/location-units/campuses'),
('inventory.locinstitution', '/location-units/institutions'),
('inventory.loclibrary', '/location-units/libraries'),
('inventory.material_type', '/material-types'),
('inventory.mode_of_issuance', '/modes-of-issuance'),
('inventory.nature_of_content_term', '/nature-of-content-terms'),
('inventory.service_point', '/service-points'),
('inventory.service_point_user', '/service-points-users'),
('inventory.statistical_code', '/statistical-codes'),
('inventory.statistical_code_type', '/statistical-code-types'),
('inventory.subject_sources', '/subject-sources'),
('inventory.subject_types', '/subject-types'),
('inventory.bound_width_parts', '/inventory-storage/bound-with-parts'),
('inventory.instance_relationship', '/instance-storage/instance-relationships'),
('inventory.instance_relationship_type', '/instance-relationship-types'),
('inventory.preceding_suceeding_titles', '/preceding-succeeding-titles'),
('inventory.holdings_note_type', '/holdings-note-types'),
('inventory.holdings_type', '/holdings-types'),
('inventory.instance_note_type', '/instance-note-types'),
('inventory.instance_type', '/instance-types'),
('inventory.instance_status', '/instance-statuses'),
('inventory.instance_format', '/instance-formats'),
('inventory.item_note_type', '/item-note-types'),
('inventory.item_damaged_status', '/item-damaged-statuses'),
]
tables = []
for q in queries:
try:
t = ld.query(table=q[0], path=q[1], keep_raw=False)
tables += t
except Exception as ex:
print('folio_demo.py: error processing "' + q[1] + '"', file=sys.stderr)
print(ex, file=sys.stderr)
print()
print('Tables:')
for t in tables:
print(t)
print('(' + str(len(tables)) + ' tables)')