Skip to content

Commit

Permalink
Merge pull request #10 from pmodwrc/issue5
Browse files Browse the repository at this point in the history
Issue5
  • Loading branch information
gosow9 authored Aug 13, 2024
2 parents bb5df84 + 051acc9 commit fb8a68a
Show file tree
Hide file tree
Showing 8 changed files with 11,860 additions and 354 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,4 @@ cython_debug/

# Pypi configs
.pypirc
tests/unit/data/config.yaml
61 changes: 61 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
database:
type: mysql
host: localhost
user: user
password: password
db_name: test_db
token:
port: 3306

fits_files:
paths:
#- tests\unit\data\2021-07-07_L1a.fits
# - tests\unit\data\test.fits
#- tests\unit\data
- \\ad.pmodwrc.ch\Institute\Projects\FY-3E\JOIM\16_Flight_Data\LEVEL_1\2021

tables:
- name: HOUSEKEEPING
target_table: RAW_HOUSEKEEPING
ingest_all_columns: true
description: "Table containing user information"
columns:
- name: timestamp
type: timestamp
precision: us


- name: JTSIM_BROADCAST
ingest_all_columns: true
description: "Table containing order information"
columns:
- name: order_id
type: integer
primary_key: true
auto_increment: true
description: "Unique identifier for the order"
- name: user_id
type: integer
nullable: false
foreign_key:
table: users
column: id
description: "ID of the user who placed the order"
- name: order_date
type: datetime
nullable: false
default: "CURRENT_TIMESTAMP"
description: "Date and time when the order was placed"
- name: total_amount
type: decimal(10, 2)
nullable: false
description: "Total amount for the order"
- name: status
type: varchar(20)
nullable: false
default: "pending"
description: "Current status of the order"




4 changes: 3 additions & 1 deletion fits2db/adapters/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,10 @@ def upsert(self) -> None:
log.debug("Starting upsert operation.")
try:
if self.loader:
self.loader.upsert_file()
self.loader.upload_file()
log.info("Upsert operation completed successfully.")
self.loader.close_connection()
log.info("Connection closed")
else:
log.error("Loader is not initialized.")
except Exception as e:
Expand Down
Loading

0 comments on commit fb8a68a

Please sign in to comment.