Home¶
Table of Contents
What is KAITITU?¶
KAITITU is a library to deal with common tasks on databases. It has a generic API that helps on operational and analytical tasks for popular database management system.
License¶
KAITITU is released under the terms of the Apache license v2.0. See LICENSE for information.
Getting started¶
KAITITU is available in PyPI.org, so the recommended method to install is $ pip install kaititu. Otherwise, you can download the source code and run by yourself.
In a nutshell, the first requirement is a subclass of kaititu.Database, it’s resposible to manage database connections and calls.
The second piece is an instance of some class that uses kaititu.Database; for example, the kaititu.audit.AccessControlReport class.
With this minimum setup, you can use KAITITU like in the code sample below.
1from kaititu.audit.postgres import PostgresACR
2from kaititu import Postgres
3
4# the user must have privileges to read system objects of database
5db=Postgres("127.0.0.1",5432,"dba","654321")
6
7# print the database version as a banner
8print(db.version)
9
10with db.connect() as connection:
11 acr=PostgresACR(connection)
12 # get profiles that have undue privileges on tables. See the docs for detail.
13 result=acr.profile_undue_table_privileges()
14 # print the corresponding polars.DataFrame
15 print(result)
To better understanding KAITITU, read the documentation exploring the left-side menu.
Troubleshooting¶
Although the management of library dependencies is being handled, the drivers required by such libraries are not installed automatically. Therefore, make sure that the necessary drivers for connecting to Oracle, MS SQL Server, and others are functional on your operating system.
Polars doesn’t work with older processors that lack AVX2 instructions. So, if that’s your situation, you’ll need to replace polars with polars-lts-cpu. For more details, check the official documentation.