EimerDB
Project description
EimerDB
Features
Google Cloud Storage Integration
Create your own database for data storage by specifying bucket name and a database name.
create_eimerdb(bucket="bucket-name", db_name="prodcombasen")
Connect to your EimerDB database hosted on Google Cloud Storage.
prodcombasen = EimerDBInstance("bucket-name", "prodcombasen")
Table Management
Easily create tables with defined schemas.
prodcombasen.create_table(
table_name="prefill_prod",
schema,
partition_columns=["aar"],
editable=True
)
Partition tables for efficient data organization.
SQL Query Support
Query your tables with SQL syntax. Specify partition selection for row skipping, making queries faster
prodcombasen.query(
"""SELECT *
FROM prodcom_prefill
WHERE produktkode = '10.13.11.20'""",
partition_select = {
"aar": [2022, 2021]
}
Data Updates
Perform updates using SQL statements Each update is saved as a separate file for versioning. The update files includes a username column with the user who made the update and a datetime column for when the update happened.
prodcombasen.query(
"""UPDATE prodcom_prefill
SET mengde = 123
WHERE ident = '123456'
AND produktkode = '10.13.11.20'""",
partition_select = partitions
)
Unedited Data Access
Retrieve the unedited version of your data.
prodcombasen.query(
"""SELECT *
FROM prodcom_prefill""",
unedited=True
)
Query multiple tables
Query multiple tables using JOIN and subquery.
prodcombasen.query(
f"""SELECT
t1.aar,
t1.produktkode,
t1.beskrivelse,
SUM(t1.mengde) AS mengde
FROM
prefill_prod AS t1
JOIN (
SELECT
t2.aar,
t2.ident,
t2.skjemaversjon,
MAX(t2.dato_mottatt) AS newest_dato_mottatt
FROM
skjemainfo AS t2
GROUP BY
t2.aar,
t2.ident,
t2.skjemaversjon
) AS subquery ON
t1.aar = subquery.aar
AND t1.ident = subquery.ident
AND t1.skjemaversjon = subquery.skjemaversjon
WHERE
t1.mengde IS NOT NULL
GROUP BY
t1.aar,
t1.produktkode,
t1.beskrivelse;""",
partition_select={
"aar": [2022, 2021, 2020]
},
)
User Management
Add and remove users from your instance. Assign specific roles to users for access control.
mvabasen.add_user(username="newuser", role="admin")
mvabasen.remove_user(username="olduser")
Requirements
- TODO
Installation
You can install EimerDB via pip from PyPI:
pip install ssb-eimerdb
Usage
Please see the Reference Guide for details.
Contributing
Contributions are very welcome. To learn more, see the Contributor Guide.
License
Distributed under the terms of the MIT license, EimerDB is free and open source software.
Issues
If you encounter any problems, please file an issue along with a detailed description.
Credits
This project was generated from Statistics Norway's SSB PyPI Template.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for ssb_eimerdb-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99cb31c6eb10d3aecf78da98d82165bdf86cdc44648fc528933584ba18582eab |
|
MD5 | 941486054e2313637aacf9e08a11b540 |
|
BLAKE2b-256 | a9b5e39f68771d2176a230e8cee2cfd4c83909f29a66eb9e8837b6e3dce6dde3 |