'Error importing "enchant" in google colab
I did the following in google colab notebook and get an error. Any idea?
%pip install pyenchant
import enchant
and get the following error:
ImportError Traceback (most recent call last) in () ----> 1 import enchant
1 frames /usr/local/lib/python3.7/dist-packages/enchant/_enchant.py in () 159 """ 160 ) --> 161 raise ImportError(msg) 162 163
ImportError: The 'enchant' C library was not found and needs to be installed. See https://pyenchant.github.io/pyenchant/install.html for details
Solution 1:[1]
After lots of research, I found the solution here.
Run this code on goggle colab before import enchant
!apt update
!apt install enchant --fix-missing
!apt install -qq enchant
!pip install pyenchant
Solution 2:[2]
Yes enchant doesnt work on Google colab because of C libraries. You can use Jupyter notebook for this library and it will work just fine.
Solution 3:[3]
I'm not a user of the AWS SDK for client-rds-data, but I'm inferring the following from the documentation, and my own knowledge of MySQL.
I see that interface ExecuteSqlCommandInput has a property sqlStatements, which allows multiple SQL statements separated by semicolons. This precludes the use of query parameters, because in MySQL you can't use prepare() on a string that includes multiple SQL statements.
Whereas ExecuteStatementCommandInput has a property sql (a single statement) and a property parameters which is an array of scalar parameters (i.e. each scalar corresponds to one parameter placeholder in the sql string). This should allow you to run a parameterized SQL query.
Re your comment: When you said you wanted to use prepared statements to avoid SQL injection vulnerabilities, I assumed you understood how prepared statements protect against those vulnerabilities.
In fact, using prepared statements alone is not a defense. You have to separate dynamic inputs from your SQL query by using query parameters. It just happens that using query parameters requires using prepared statements, so people say "use prepared statements" to defend against SQL injection, when they should say "use query parameters, which implies you must use prepared statements."
Tutorials about using SQL with query parameters are abundant. Here's one for Node.js: https://www.veracode.com/blog/secure-development/how-prevent-sql-injection-nodejs
The calling convention for the AWS SDK is different, but the concept is the same. I have only found reference documentation for AWS SDK, no code examples or task-oriented documentation. This is disappointing but unfortunately typical for AWS.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | |
| Solution 3 |
