Aurora MySQL - Able to insert into enum field via mysqlclient but unable to insert using pymysql - How can this be done?2019 Community Moderator ElectionHow can I represent an 'Enum' in Python?Can I concatenate multiple MySQL rows into one field?How can I view live MySQL queries?How to 'insert if not exists' in MySQL?How to copy a row and insert in same table with a autoincrement field in MySQL?Unable to Insert into MySQL via Python and pymysqlPymysql can not link to the mysqlinsert into mysql database with pymysql failing to insertUnable to connect to mysql with pymysqlInserting data into a table in MySQL with PyMySQL
Why does Deadpool say "You're welcome, Canada," after shooting Ryan Reynolds in the end credits?
How to generate globally unique ids for different tables of the same database?
Instead of Universal Basic Income, why not Universal Basic NEEDS?
What is IP squat space
Know when to turn notes upside-down(eighth notes, sixteen notes, etc.)
Why must traveling waves have the same amplitude to form a standing wave?
Can hydraulic brake levers get hot when brakes overheat?
Can anyone tell me why this program fails?
How to explain that I do not want to visit a country due to personal safety concern?
Should we release the security issues we found in our product as CVE or we can just update those on weekly release notes?
Identifying the interval from A♭ to D♯
Co-worker team leader wants to inject his friend's awful software into our development. What should I say to our common boss?
Life insurance that covers only simultaneous/dual deaths
Old race car problem/puzzle
Is it true that real estate prices mainly go up?
Make a transparent 448*448 image
Russian cases: A few examples, I'm really confused
Replacing Windows 7 security updates with anti-virus?
Font with correct density?
Does the statement `int val = (++i > ++j) ? ++i : ++j;` invoke undefined behavior?
How Did the Space Junk Stay in Orbit in Wall-E?
How to answer questions about my characters?
Official degrees of earth’s rotation per day
What options are left, if Britain cannot decide?
Aurora MySQL - Able to insert into enum field via mysqlclient but unable to insert using pymysql - How can this be done?
2019 Community Moderator ElectionHow can I represent an 'Enum' in Python?Can I concatenate multiple MySQL rows into one field?How can I view live MySQL queries?How to 'insert if not exists' in MySQL?How to copy a row and insert in same table with a autoincrement field in MySQL?Unable to Insert into MySQL via Python and pymysqlPymysql can not link to the mysqlinsert into mysql database with pymysql failing to insertUnable to connect to mysql with pymysqlInserting data into a table in MySQL with PyMySQL
Consider the following schema on Aurora MySQL 5.6:
create table temp_table (
`id` bigint,
`term_frequency` enum('Weekly','Monthly','Fortnightly','Quarterly') NOT NULL,
PRIMARY KEY(id)
);
The sql_mode parameter is set to empty, hence, it is possible to have the term_frequency field as and empty quote ''.
Hence, the following query works when executed from a mysql client.
insert into temp_table values (1, '');
However, while I am using a pymysql connector, through python3, I am unable to do the same.
import pymysql
connection = pymysql.connect(host, pass, database)
cursor = connection.cursor()
cursor.execute('''insert into temp_table values (1, '');''')
connection.commit()
This throws the following error:
(1265, "Data truncated for column 'term_frequency' at row 1")
Why is this happening and how can I resolve this in pymysql?
python mysql sql pymysql aurora
add a comment |
Consider the following schema on Aurora MySQL 5.6:
create table temp_table (
`id` bigint,
`term_frequency` enum('Weekly','Monthly','Fortnightly','Quarterly') NOT NULL,
PRIMARY KEY(id)
);
The sql_mode parameter is set to empty, hence, it is possible to have the term_frequency field as and empty quote ''.
Hence, the following query works when executed from a mysql client.
insert into temp_table values (1, '');
However, while I am using a pymysql connector, through python3, I am unable to do the same.
import pymysql
connection = pymysql.connect(host, pass, database)
cursor = connection.cursor()
cursor.execute('''insert into temp_table values (1, '');''')
connection.commit()
This throws the following error:
(1265, "Data truncated for column 'term_frequency' at row 1")
Why is this happening and how can I resolve this in pymysql?
python mysql sql pymysql aurora
add a comment |
Consider the following schema on Aurora MySQL 5.6:
create table temp_table (
`id` bigint,
`term_frequency` enum('Weekly','Monthly','Fortnightly','Quarterly') NOT NULL,
PRIMARY KEY(id)
);
The sql_mode parameter is set to empty, hence, it is possible to have the term_frequency field as and empty quote ''.
Hence, the following query works when executed from a mysql client.
insert into temp_table values (1, '');
However, while I am using a pymysql connector, through python3, I am unable to do the same.
import pymysql
connection = pymysql.connect(host, pass, database)
cursor = connection.cursor()
cursor.execute('''insert into temp_table values (1, '');''')
connection.commit()
This throws the following error:
(1265, "Data truncated for column 'term_frequency' at row 1")
Why is this happening and how can I resolve this in pymysql?
python mysql sql pymysql aurora
Consider the following schema on Aurora MySQL 5.6:
create table temp_table (
`id` bigint,
`term_frequency` enum('Weekly','Monthly','Fortnightly','Quarterly') NOT NULL,
PRIMARY KEY(id)
);
The sql_mode parameter is set to empty, hence, it is possible to have the term_frequency field as and empty quote ''.
Hence, the following query works when executed from a mysql client.
insert into temp_table values (1, '');
However, while I am using a pymysql connector, through python3, I am unable to do the same.
import pymysql
connection = pymysql.connect(host, pass, database)
cursor = connection.cursor()
cursor.execute('''insert into temp_table values (1, '');''')
connection.commit()
This throws the following error:
(1265, "Data truncated for column 'term_frequency' at row 1")
Why is this happening and how can I resolve this in pymysql?
python mysql sql pymysql aurora
python mysql sql pymysql aurora
asked Mar 6 at 18:36
Sathyasarathi GunasekaranSathyasarathi Gunasekaran
9010
9010
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55030037%2faurora-mysql-able-to-insert-into-enum-field-via-mysqlclient-but-unable-to-inse%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55030037%2faurora-mysql-able-to-insert-into-enum-field-via-mysqlclient-but-unable-to-inse%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown