echoss-query


Nameechoss-query JSON
Version 1.0.8 PyPI version JSON
download
home_pageNone
Summaryechoss AI Bigdata Solution - Query Package
upload_time2024-11-26 21:37:04
maintainerNone
docs_urlNone
authorincheolshin
requires_python>3.7
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # echoss_query
-------------
MySQL, MongoDB, Opensearch compatible query access package

## Prepare
사용 전 config(인증 정보) 의 유무를 확인한 뒤 사용해야한다.
config file example:
```
mysql:
    user : <user_id>
    passwd : <pass code>
    host : <IP addrress or domain>
    port : :<network port number>
    db : <schema name>
    charset : utf8

mongo:
    host : <IP addrress or domain>
    port :<network port number>
    db : <database name>

elastic:
    user : <user_id>
    passwd : <pass code>
    host : <IP addrress or domain>
    port : :<network port number>
    index : <index name>
```

## Installaion
-------------
To install this package, please use Python 3.8 or higher.

```
    pip install -U echoss-query
```

## Quick Start

### Import package and class
```
    from echoss_query import MysqlQuery, MongoQuery, ElasticSearch

    mysql = MysqlQuery('CONFIG_FILE_PATH' or dict)
    mongo = MongoQuery('CONFIG_FILE_PATH' or dict)
    elastic = ElasticSearch('CONFIG_FILE_PATH' or dict)
```

### MySQL
-------------
```
    # CREATE
    mysql.create('QUERY_STRING')

    # DROP
    mysql.drop('QUERY_STRING')

    # TRUNCATE
    mysql.truncate('QUERY_STRING')

    # ALTER
    mysql.alter('QUERY_STRING')

    # SELECT
    mysql.select('QUERY_STRING', params=None) -> dataframe
    mysql.select_one('QUERY_STRING', params=None) -> dict
    mysql.select_list('QUERY_STRING', params=None) -> list(dict)
    mysql.faster_select('QUERY_STRING', params=None) -> dataframe

    # INSERT without params
    mysql.insert('QUERY_STRING', params=None) -> int
    # INSERT with tuple
    mysql.insert('QUERY_STRING', params) -> int
    # INSERT with list[tuple]
    mysql.insert('QUERY_STRING', params_list) -> int

    # UPDATE
    mysql.update('QUERY_STRING', params=None) -> int

    # DELETE
    mysql.delete('QUERY_STRING', params=None) -> int

    # show Database
    mysql.databases()

    # show Tables
    mysql.tables()

    # Ping
    mysql.ping()

    # get connection cursor
    mysql.conn_cursor(cursorclass=None)

    # Close
    # crash process close
    mysql.close()

    # debug query : default True
    mysql.debug_query(False)
```

### MongoDB
-------------
```
    # show Database
    mongo.databases()

    # show Collections
    mongo.collections()

    # Ping
    mongo.ping()

    # SELECT
    mongo.select('COLLECTION_NAME','QUERY_STRING or DICTIONARY') -> pd.Dataframe

    # INSERT
    mongo.insert('COLLECTION_NAME','QUERY_STRING or DICTIONARY')
    mongo.insert_many('COLLECTION_NAME','QUERY_STRING or DICTIONARY')

    # UPDATE
    mongo.update('COLLECTION_NAME','FILTER_STRING or DICTIONARY', 'UPDATE_STRING or DICTIONARY')
    mongo.update_many('COLLECTION_NAME','FILTER_STRING or DICTIONARY', 'UPDATE_STRING or DICTIONARY')

    # DELETE
    mongo.delete('COLLECTION_NAME','QUERY_STRING or DICTIONARY')
    mongo.delete_many('COLLECTION_NAME','QUERY_STRING or DICTIONARY')

```

### ElasticSearch
-------------
```
    # CREATE
    elastic.index(index='INDEX_NAME')

    # DROP
    elastic.delete_index(index='INDEX_NAME')

    # SELECT
    elastic.search(body=query) -> any
    elastic.search_list(body=query, fetch_all=True) -> list
    elastic.search_dataframe(body=query, fetch_all=True) -> dataframe
    elastic.search_field(field='FIELD_NAME',value='VALUE') -> list

    # INSERT
    elastic.create(id='ID', body='JSON_BODY')

    #UPDATE
    elastic.update(id='ID', body='JSON_BODY')

    #DELETE
    elastic.delete(id='ID')

    # Ping
    elastic.ping()

    # Connection Information
    elastic.info()
```

### Code Quality
When creating new functions, please follow the Google style Python docstrings. See example below:
```
def example_function(param1: int, param2: str) -> bool:
    """Example function that does something.

    Args:
        param1: The first parameter.
        param2: The second parameter.

    Returns:
        The return value. True for success, False otherwise.

    """
```

## Version history
v0.1.0 initial version
v0.1.1 echoss_logger include
v0.1.7 mysql support query with params. return cursor.rowcount for insert/update/delete query
v1.0.0 mysql support query with list params
v1.0.1 elastic search_list fetch_all option, mongo support insert_many, delete_many, update_many method
v1.0.2 mysql reuse cursor

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "echoss-query",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">3.7",
    "maintainer_email": null,
    "keywords": null,
    "author": "incheolshin",
    "author_email": "incheolshin@12cm.co.kr",
    "download_url": "https://files.pythonhosted.org/packages/ac/5d/a67e9bb180d1ac25fc753bfb16429fea02a3a2daedc4750c0a49746b33ac/echoss_query-1.0.8.tar.gz",
    "platform": null,
    "description": "# echoss_query\n-------------\nMySQL, MongoDB, Opensearch compatible query access package\n\n## Prepare\n\uc0ac\uc6a9 \uc804 config(\uc778\uc99d \uc815\ubcf4) \uc758 \uc720\ubb34\ub97c \ud655\uc778\ud55c \ub4a4 \uc0ac\uc6a9\ud574\uc57c\ud55c\ub2e4.\nconfig file example:\n```\nmysql:\n    user : <user_id>\n    passwd : <pass code>\n    host : <IP addrress or domain>\n    port : :<network port number>\n    db : <schema name>\n    charset : utf8\n\nmongo:\n    host : <IP addrress or domain>\n    port :<network port number>\n    db : <database name>\n\nelastic:\n    user : <user_id>\n    passwd : <pass code>\n    host : <IP addrress or domain>\n    port : :<network port number>\n    index : <index name>\n```\n\n## Installaion\n-------------\nTo install this package, please use Python 3.8 or higher.\n\n```\n    pip install -U echoss-query\n```\n\n## Quick Start\n\n### Import package and class\n```\n    from echoss_query import MysqlQuery, MongoQuery, ElasticSearch\n\n    mysql = MysqlQuery('CONFIG_FILE_PATH' or dict)\n    mongo = MongoQuery('CONFIG_FILE_PATH' or dict)\n    elastic = ElasticSearch('CONFIG_FILE_PATH' or dict)\n```\n\n### MySQL\n-------------\n```\n    # CREATE\n    mysql.create('QUERY_STRING')\n\n    # DROP\n    mysql.drop('QUERY_STRING')\n\n    # TRUNCATE\n    mysql.truncate('QUERY_STRING')\n\n    # ALTER\n    mysql.alter('QUERY_STRING')\n\n    # SELECT\n    mysql.select('QUERY_STRING', params=None) -> dataframe\n    mysql.select_one('QUERY_STRING', params=None) -> dict\n    mysql.select_list('QUERY_STRING', params=None) -> list(dict)\n    mysql.faster_select('QUERY_STRING', params=None) -> dataframe\n\n    # INSERT without params\n    mysql.insert('QUERY_STRING', params=None) -> int\n    # INSERT with tuple\n    mysql.insert('QUERY_STRING', params) -> int\n    # INSERT with list[tuple]\n    mysql.insert('QUERY_STRING', params_list) -> int\n\n    # UPDATE\n    mysql.update('QUERY_STRING', params=None) -> int\n\n    # DELETE\n    mysql.delete('QUERY_STRING', params=None) -> int\n\n    # show Database\n    mysql.databases()\n\n    # show Tables\n    mysql.tables()\n\n    # Ping\n    mysql.ping()\n\n    # get connection cursor\n    mysql.conn_cursor(cursorclass=None)\n\n    # Close\n    # crash process close\n    mysql.close()\n\n    # debug query : default True\n    mysql.debug_query(False)\n```\n\n### MongoDB\n-------------\n```\n    # show Database\n    mongo.databases()\n\n    # show Collections\n    mongo.collections()\n\n    # Ping\n    mongo.ping()\n\n    # SELECT\n    mongo.select('COLLECTION_NAME','QUERY_STRING or DICTIONARY') -> pd.Dataframe\n\n    # INSERT\n    mongo.insert('COLLECTION_NAME','QUERY_STRING or DICTIONARY')\n    mongo.insert_many('COLLECTION_NAME','QUERY_STRING or DICTIONARY')\n\n    # UPDATE\n    mongo.update('COLLECTION_NAME','FILTER_STRING or DICTIONARY', 'UPDATE_STRING or DICTIONARY')\n    mongo.update_many('COLLECTION_NAME','FILTER_STRING or DICTIONARY', 'UPDATE_STRING or DICTIONARY')\n\n    # DELETE\n    mongo.delete('COLLECTION_NAME','QUERY_STRING or DICTIONARY')\n    mongo.delete_many('COLLECTION_NAME','QUERY_STRING or DICTIONARY')\n\n```\n\n### ElasticSearch\n-------------\n```\n    # CREATE\n    elastic.index(index='INDEX_NAME')\n\n    # DROP\n    elastic.delete_index(index='INDEX_NAME')\n\n    # SELECT\n    elastic.search(body=query) -> any\n    elastic.search_list(body=query, fetch_all=True) -> list\n    elastic.search_dataframe(body=query, fetch_all=True) -> dataframe\n    elastic.search_field(field='FIELD_NAME',value='VALUE') -> list\n\n    # INSERT\n    elastic.create(id='ID', body='JSON_BODY')\n\n    #UPDATE\n    elastic.update(id='ID', body='JSON_BODY')\n\n    #DELETE\n    elastic.delete(id='ID')\n\n    # Ping\n    elastic.ping()\n\n    # Connection Information\n    elastic.info()\n```\n\n### Code Quality\nWhen creating new functions, please follow the Google style Python docstrings. See example below:\n```\ndef example_function(param1: int, param2: str) -> bool:\n    \"\"\"Example function that does something.\n\n    Args:\n        param1: The first parameter.\n        param2: The second parameter.\n\n    Returns:\n        The return value. True for success, False otherwise.\n\n    \"\"\"\n```\n\n## Version history\nv0.1.0 initial version\nv0.1.1 echoss_logger include\nv0.1.7 mysql support query with params. return cursor.rowcount for insert/update/delete query\nv1.0.0 mysql support query with list params\nv1.0.1 elastic search_list fetch_all option, mongo support insert_many, delete_many, update_many method\nv1.0.2 mysql reuse cursor\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "echoss AI Bigdata Solution - Query Package",
    "version": "1.0.8",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "db3a99ac49b810c223acd97cf1c0b838fdbde288998e5d68c01ac3ebf49cc5f0",
                "md5": "f497ab3054ae5f0988ef89dc368535f8",
                "sha256": "0c2ab146a3652856199fc8ced66a0aa810e13046d8a02a06f3ae5cc16a3b1f1d"
            },
            "downloads": -1,
            "filename": "echoss_query-1.0.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f497ab3054ae5f0988ef89dc368535f8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">3.7",
            "size": 11870,
            "upload_time": "2024-11-26T21:37:03",
            "upload_time_iso_8601": "2024-11-26T21:37:03.652667Z",
            "url": "https://files.pythonhosted.org/packages/db/3a/99ac49b810c223acd97cf1c0b838fdbde288998e5d68c01ac3ebf49cc5f0/echoss_query-1.0.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ac5da67e9bb180d1ac25fc753bfb16429fea02a3a2daedc4750c0a49746b33ac",
                "md5": "f76d5df6e040658fff527aa019a3793a",
                "sha256": "42e8d6d635899cd8b8e8673b5c2a009376f6993bbdab2fed7d13ee4fa20177ea"
            },
            "downloads": -1,
            "filename": "echoss_query-1.0.8.tar.gz",
            "has_sig": false,
            "md5_digest": "f76d5df6e040658fff527aa019a3793a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">3.7",
            "size": 12065,
            "upload_time": "2024-11-26T21:37:04",
            "upload_time_iso_8601": "2024-11-26T21:37:04.933518Z",
            "url": "https://files.pythonhosted.org/packages/ac/5d/a67e9bb180d1ac25fc753bfb16429fea02a3a2daedc4750c0a49746b33ac/echoss_query-1.0.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-26 21:37:04",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "echoss-query"
}
        
Elapsed time: 0.46020s