Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
DBRepo
Manage
Activity
Members
Labels
Plan
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FAIR Data Austria DB Repository
DBRepo
Commits
9b5508c9
Verified
Commit
9b5508c9
authored
5 months ago
by
Martin Weise
Browse files
Options
Downloads
Patches
Plain Diff
Updated the library readme
Signed-off-by:
Martin Weise
<
martin.weise@tuwien.ac.at
>
parent
3ec8b119
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!386
WIP
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/python/README.md
+12
-7
12 additions, 7 deletions
lib/python/README.md
with
12 additions
and
7 deletions
lib/python/README.md
+
12
−
7
View file @
9b5508c9
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
Official client library for
[
DBRepo
](
https://www.ifs.tuwien.ac.at/infrastructures/dbrepo/1.4.3/
)
, a database
Official client library for
[
DBRepo
](
https://www.ifs.tuwien.ac.at/infrastructures/dbrepo/1.4.3/
)
, a database
repository to support research based
repository to support research based
on
[
requests
](
https://pypi.org/project/requests/
)
,
[
pydantic
](
https://pypi.org/project/pydantic/
)
,
[
tuspy
](
https://pypi.org/project/tuspy/
)
on
[
requests
](
https://pypi.org/project/requests/
)
,
[
pydantic
](
https://pypi.org/project/pydantic/
)
and
[
pika
](
https://pypi.org/project/pika/
)
.
and
[
pika
](
https://pypi.org/project/pika/
)
.
## Installing
## Installing
...
@@ -20,9 +20,11 @@ Get public data from a table as pandas `DataFrame`:
...
@@ -20,9 +20,11 @@ Get public data from a table as pandas `DataFrame`:
```
python
```
python
from
dbrepo.RestClient
import
RestClient
from
dbrepo.RestClient
import
RestClient
client
=
RestClient
(
endpoint
=
"
https://dbrepo
1.ec
.tuwien.ac.at
"
)
client
=
RestClient
(
endpoint
=
"
https://
test.
dbrepo.tuwien.ac.at
"
)
# Get a small data slice of just three rows
# Get a small data slice of just three rows
df
=
client
.
get_table_data
(
database_id
=
7
,
table_id
=
13
,
page
=
0
,
size
=
3
,
df
=
True
)
df
=
client
.
get_table_data
(
database_id
=
"
e0d82287-9099-4077-8f69-3c19fc3bc145
"
,
table_id
=
"
71f8c746-ea26-4651-b3f2-ce46830f1af4
"
,
page
=
0
,
size
=
3
)
print
(
df
)
print
(
df
)
# x_coord component unit ... value stationid meantype
# x_coord component unit ... value stationid meantype
# 0 16.52617 Feinstaub (PM10) µg/m³ ... 21.0 01:0001 HMW
# 0 16.52617 Feinstaub (PM10) µg/m³ ... 21.0 01:0001 HMW
...
@@ -32,19 +34,23 @@ print(df)
...
@@ -32,19 +34,23 @@ print(df)
# [3 rows x 12 columns]
# [3 rows x 12 columns]
```
```
I
mport
d
ata into a table:
Create table and i
mport
`D
ata
Frame`
into a table:
```
python
```
python
import
pandas
as
pd
import
pandas
as
pd
from
dbrepo.RestClient
import
RestClient
from
dbrepo.RestClient
import
RestClient
client
=
RestClient
(
endpoint
=
"
https://dbrepo
1.ec
.tuwien.ac.at
"
,
username
=
"
foo
"
,
client
=
RestClient
(
endpoint
=
"
https://
test.
dbrepo.tuwien.ac.at
"
,
username
=
"
foo
"
,
password
=
"
bar
"
)
password
=
"
bar
"
)
df
=
pd
.
DataFrame
(
data
=
{
'
x_coord
'
:
16.52617
,
'
component
'
:
'
Feinstaub (PM10)
'
,
df
=
pd
.
DataFrame
(
data
=
{
'
x_coord
'
:
16.52617
,
'
component
'
:
'
Feinstaub (PM10)
'
,
'
unit
'
:
'
µg/m³
'
,
...})
'
unit
'
:
'
µg/m³
'
,
...})
client
.
import_table_data
(
database_id
=
7
,
table_id
=
13
,
file_name_or_data_frame
=
df
)
client
.
create_table
(
database_id
=
"
e0d82287-9099-4077-8f69-3c19fc3bc145
"
,
name
=
"
Sensor
"
,
is_public
=
True
,
is_schema_public
=
True
,
dataframe
=
df
)
```
```
... or just create the table schema by setting
`create_table(..., withData=False)`
.
## Supported Features & Best-Practices
## Supported Features & Best-Practices
-
Manage user
-
Manage user
...
@@ -76,7 +82,6 @@ AMQP_API_PORT="5672"
...
@@ -76,7 +82,6 @@ AMQP_API_PORT="5672"
AMQP_API_USERNAME="foo"
AMQP_API_USERNAME="foo"
AMQP_API_PASSWORD="bar"
AMQP_API_PASSWORD="bar"
AMQP_API_VIRTUAL_HOST="dbrepo"
AMQP_API_VIRTUAL_HOST="dbrepo"
REST_UPLOAD_ENDPOINT="https://dbrepo1.ec.tuwien.ac.at/api/upload/files"
```
```
You can disable logging by setting the log level to e.g.
`INFO`
:
You can disable logging by setting the log level to e.g.
`INFO`
:
...
...
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