Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Crisis Events Text Summarization
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Francesco Crisafulli
Crisis Events Text Summarization
Commits
c54cf8e3
Commit
c54cf8e3
authored
1 year ago
by
fcrisafulli-dev
Browse files
Options
Downloads
Patches
Plain Diff
database init code
parent
f9491d99
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
crisis_events.db
+0
-0
0 additions, 0 deletions
crisis_events.db
databaseAPI.py
+15
-8
15 additions, 8 deletions
databaseAPI.py
init_database.sql
+12
-1
12 additions, 1 deletion
init_database.sql
with
27 additions
and
9 deletions
crisis_events.db
+
0
−
0
View file @
c54cf8e3
No preview for this file type
This diff is collapsed.
Click to expand it.
databaseAPI.py
+
15
−
8
View file @
c54cf8e3
...
...
@@ -9,16 +9,23 @@ def init_database():
connection
=
sqlite3
.
connect
(
"
crisis_events.db
"
)
cur
=
connection
.
cursor
()
cur
.
execute
(
"
CREATE TABLE movie(title, year, score)
"
)
cur
.
execute
(
"""
INSERT INTO movie VALUES
(
'
Monty Python and the Holy Grail
'
, 1975, 8.2),
(
'
And Now for Something Completely Different
'
, 1971, 7.5)
"""
)
with
open
(
"
init_database.sql
"
,
"
r
"
)
as
f
:
sql
=
f
.
read
()
cur
.
executescript
(
sql
)
# cur.execute("CREATE TABLE movie(title, year, score)")
res
=
cur
.
execute
(
"
SELECT name FROM sqlite_master
"
)
print
(
res
.
fetchone
())
# cur.execute("""
# INSERT INTO movie VALUES
# ('Monty Python and the Holy Grail', 1975, 8.2),
# ('And Now for Something Completely Different', 1971, 7.5)
# """)
# res = cur.execute("SELECT * FROM event_collections")
# print(res.fetchone())
cur
.
close
()
connection
.
close
()
...
...
This diff is collapsed.
Click to expand it.
init_database.sql
+
12
−
1
View file @
c54cf8e3
DROP
TABLE
\ No newline at end of file
DROP
TABLE
IF
EXISTS
event_collections
;
CREATE
TABLE
event_collections
(
collection_id
INTEGER
PRIMARY
KEY
,
owner_id
INTEGER
,
collection_binary
BLOB
,
collection_summary
TEXT
);
INSERT
INTO
event_collections
VALUES
(
0
,
15
,
"binary"
,
"Summary for collection 0"
),
(
1
,
15
,
"binary"
,
"Summary for collection 1"
);
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment