Skip to main content

A Python library quickly store and fetch different types of data.

Project description

GestUniDt

It is a very basic personal project to quickly store and fetch different types of data into csv files

Installation

pip install GestUniDt

Usage

# Import the library
from GestUniDt import Gud 

# Initialize the main class
g = Gud()

# Use the .new('file_name') method to create a new file
# Use the .idCol() method to add an auto-incrementing id column
# Use the .timeCol() method to add a column that will show the time when a row is added
# Use the .textCol() method to add a simple text column
# Use the .dataCol() to add different types of data who'll be serialized
# You can use multiple textCols and dataCols
g.new('log.csv').idCol().timeCol().textCol('source').textCol('type').dataCol('content')

# Use the .load('file_name') to load an existing file
g.load('log.csv')

# Use the .add() method to add a row
# You can use a list with textCols and dataCols values in order
# You can add multiple lists to add multiple rows
g.add(['Main Function', 'Info', 'Starting the program...'], ['Config Function', 'Error', 'File Config Not Found.'])

# You can also use one or multiple dictionaries as parameter to add rows
g.add({'type': 'log', 'content': 'Another log message.'})

# You can add lists in dataCols
g.add(['numbers', [1, 2, 3, 4]])

# You can add dictionaries in dataCols
g.add(['objects', {'name': 'chair', 'code': 'ab123cd'}])


# Use the .get() method to make query-like data fetching
# Use the .where(col, condition) method to filter the rows
# Use the .cols([cols_list]) to get only selected columns
# Use the .last(n) and the .first(n) methods to get the last or the first n columns
# Use the .values() method to get the result as a list
# Without any other method the .get() method will return the entire content
# Without the .values() method the result will be returned as a dataframe
# You can use multiple .where() methods to add more conditions
# the .where() method accepts "=", "!=", ">", "<", ">=", "<=" conditions


res = g.get().where('type', '= log').cols(['type', 'content']).values()
res = g.get().where('id', '> 2').cols(['id', 'type', 'content']).last(2).values()
res = g.get().where('id', '> 2').where('type', '= log').cols(['id', 'type', 'content']).last(2).values()


# Use the .del_() method to delete one or multiple rows with .where() method filtering.
deleted_count = g.del_().where('type', '= log').execute()

# Use the .count() method to get the actual number of rows
current_count = g.count()

# Use the .clear() method to delete every row
g.clear()

# Use the .deleteCsvFile() method to delete the file.
g.deleteCsvFile()

Development status

GestUniDt is a work-in-progress personal project. Suggestions, feature requests, and constructive feedback are highly welcome. Feel free to open an issue or submit a pull request.

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

gestunidt-1.0.1.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

GestUniDt-1.0.1-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file gestunidt-1.0.1.tar.gz.

File metadata

  • Download URL: gestunidt-1.0.1.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.4

File hashes

Hashes for gestunidt-1.0.1.tar.gz
Algorithm Hash digest
SHA256 61e90afc56231c64cfc1e7042309b359a4d5f1c822e386058bd35e2b6a8d5185
MD5 9156f0566f1966d026dcd7c22988b6cd
BLAKE2b-256 929b37b8d07888b8438414ef9798c416e0b023e8217a1ebaaed26e7163867b0b

See more details on using hashes here.

File details

Details for the file GestUniDt-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: GestUniDt-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.4

File hashes

Hashes for GestUniDt-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c109045d1d1b5948eb04fa896d19a88108fd7221109b87cf63031e16f09419cb
MD5 aa571a42d3cc890ad50f2b46aba98044
BLAKE2b-256 6045f114711f49942411b0a844612aeb89c91541a147b3d1bbc681c7fb45b504

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page