GithubHelp home page GithubHelp logo

sergegoussev / pysqlc Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 5.81 MB

Simple python abstraction library for SQL databases

Home Page: https://sergegoussev.github.io/pysqlc/

License: MIT License

Python 99.44% HTML 0.56%
databases mysql python3 sqlserver

pysqlc's People

Contributors

sergegoussev avatar

Stargazers

 avatar

pysqlc's Issues

separate functionality of db.py

db.py has two unique things: connecting to the db and querying data. These should be separate objects with the db as parent, and another one as child that is inherited

enhance encryption to handle sha2

pysqlc does not utilize the SHA2 encryption method. The current connection is made using the legacy mysql native password:

self.conn = mysql.connector.connect(
                host=self.login['host'],
                user=self.login['username'],
                password=self.login['password'],
                port=self.login['port'],
                charset=self.login['charset'],
                database=None,
                auth_plugin='mysql_native_password'
            )

For now, this gets around the Authentication plugin 'caching_sha2_password' is not supported error that is sometimes raised when connecting to SHA2 encrypted DB environments.

TO DO:

  • Refactor the connect() method to accept SHA2.

For more info, see:

bug in validation of queries, possible conflict with variable names

Prior to executing a query, pysqlc validates what type it is so as to not let users use a q_type='SELECT' (default) when a value insert is required. This is done by simply scanning the inserted sql query for main CRUD commands.

I.e. if any mod_qs = ('update', 'insert', 'replace', 'delete', 'create') are present, then the user must specify values and the q_type.

This could create conflict if there is a column being queried in a database that contains any of these columns:

---------------------------------------------------------------------------
QueryError                                Traceback (most recent call last)
<ipython-input-12-05a69d7a9b1c> in <module>
----> 1 data_community_0 = db.query(q_twts_community_0, q_type="SELECT")

~\Anaconda3\envs\e36\lib\site-packages\pysqlc\db.py in query(self, sql_query, values, q_type, executemany)
     68             else:
     69                 raise QueryError(
---> 70                     'improper q_type, please do not use SELECT when modifying data')
     71 
     72 

QueryError: improper q_type, please do not use SELECT when modifying data

Fix this potential conflict

No tests present in library

Write unit tests to validate that features work properly.

Specifically, test:

  • connecting with env variable
  • connecting manually
  • querying data (test all CRUD methods)
  • timeout on connection

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.