Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
common-package
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue 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
GSHS Utilities
common-package
Merge requests
!29
Develop
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
Develop
develop
into
main
Overview
0
Commits
153
Pipelines
0
Changes
21
Closed
Huihui, Jonathan
requested to merge
develop
into
main
1 year ago
Overview
0
Commits
153
Pipelines
0
Changes
21
Expand
0
0
Merge request reports
Viewing commit
3dab43bb
Prev
Next
Show latest version
21 files
+
1067
−
1
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
21
Search (e.g. *.vue) (Ctrl+P)
3dab43bb
Added scrapper to code base
· 3dab43bb
Jacob
authored
11 months ago
src/common/scrapers/connections.py
0 → 100755
+
18
−
0
Options
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Provide connection methods such as Postgres or sqlalchemy engine.
"""
import
logging
from
common.env
import
check_environment
as
ce
def
create_uri
(
logger
=
logging
.
getLogger
(
ce
(
"
ETL_LOGGER
"
,
"
main
"
))):
"""
Create a URI for a connection to the Postgresql database.
"""
user
=
ce
(
"
DB_USER
"
,
"
guest
"
)
pwd
=
ce
(
"
DB_PASS
"
,
"
abc123
"
)
host
=
ce
(
"
DB_HOST
"
,
"
db
"
)
db
=
ce
(
"
DB_DB
"
,
"
covidb
"
)
port
=
ce
(
"
DB_PORT
"
,
"
5432
"
)
uri
=
f
"
postgres://
{
user
}
:
{
pwd
}
@
{
host
}
:
{
port
}
/
{
db
}
"
logger
.
info
(
f
"
Created URI:
{
uri
}
"
)
return
uri
Loading