Giter Club home page Giter Club logo

py_discord_db_management's Introduction

Discord Mysql Management Framework Downloads

This package is used to dynamically add new data to your existing Mysql tables.
You're also able to delete or view data.
It'll return you an embed & a view for you to send back.

Built With

Python MySQL Discord

How to get started

  1. Install the package
pip install dbpyman==0.1.5
  1. Create a new command for your discord Bot and create a database object inside that.
database = Database(host='db_host',
                    user='db_user',
                    password='db_password',
                    port=3306,
                    database_name='db_name',
                    charset='utf8mb4')
  1. Call create_db_management and pass the database object as the parameter and return your embed & view
database = Database(host='db_host',
                    user='db_user',
                    password='db_password',
                    port=3306,
                    database_name='db_name',
                    charset='utf8mb4')

embed, view = dbpyman.create_db_management(database)
  1. Use the returned embed & view and attach them to your message
database = Database(host='db_host',
                    user='db_user',
                    password='db_password',
                    port=3306,
                    database_name='db_name',
                    charset='utf8mb4')

embed, view = dbpyman.create_db_management(database)

await interaction.response.send_message(embed=embed, view=view)

Advanced usage

The framework features various methodes to further customize the UI & behavior of your data management process.

Hide certain tables from the embed

In general the framework will attach all tables as buttons to the view.
You can prevent that by using

database = Database(...)
database.set_table_hidden('MyTableName')
database.set_table_hidden('MySecondTableName')

embed, view = dbpyman.create_db_management(database)

Hide certain columns from a table

In general the framework will generate all columns for the modal when adding data however
You can prevent that by using

database = Database(...)
database.set_column_hidden('MyTableName', 'MyColumnName')
database.set_column_hidden('MySecondTableName', 'MySecondColumnName')

embed, view = dbpyman.create_db_management(database)

Set a default value for a column

This will set a default value for that specific column. When adding data to a table, you'll see the default value as the input preview. This will also allow you to skip the insertion of those specific column input fields and simply use the assigned default value when that input field is empty ( even if the table is marked as NOT NULL ).

database = Database(...)
database.set_column_default_value('MyTableName', 'MyColumnName', 0)
database.set_column_default_value('MySecondTableName', 'MySecondColumnName', 'Banana')

embed, view = dbpyman.create_db_management(database)

Contribute

Feel free to contribute to the project, it's open source.
It's probably possible to not only support MySQL and work with inheritance to allow other database types.

py_discord_db_management's People

Contributors

janikcodes avatar

Stargazers

Takuma Tateishi avatar

Watchers

cube_master avatar  avatar

Forkers

cedriclmao

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.