Unable to save address after data migration - magento2

One or more input exceptions have occurred.
"postcode" is required. Enter and try again.
"countryId" is required. Enter and try again.
I'm filling these values in my account edit address page, but facing this issue.
https://prnt.sc/u95nez

During migration, there is a problem with the loss postcode and telephone attributes values from customer_form_attribute and eav_form_element tables.
Adding missing values might help:
INSERT INTO customer_form_attribute (form_code, attribute_id)
VALUES ('adminhtml_customer_address', '33'),
('customer_address_edit', '33'),
('customer_register_address', '33'),
('adminhtml_customer_address', '34'),
('customer_address_edit', '34'),
('customer_register_address', '34');
INSERT INTO eav_form_element (element_id, type_id, fieldset_id, attribute_id, sort_order)
VALUES (NULL, '1', NULL, '33', '7'),
(NULL, '2', NULL, '33', '7'),
(NULL, '3', NULL, '33', '6'),
(NULL, '4', NULL, '33', '6'),
(NULL, '1', NULL, '34', '9'),
(NULL, '2', NULL, '34', '9'),
(NULL, '3', NULL, '34', '8'),
(NULL, '4', NULL, '34', '8');

Related

Dash, circular callback inputs

I have a problem with an application I want to code with Dash. I have two different checklists (indicator A, indicator B). My goal is that the user can choose multiple options for only one indicator. So it is allowed to choose a,b,c and 1. It should also be possible to select c and 2,3 at the same time. The selection of a,c and 1,2 on the other hand, should be prevented. My approach to this is the following code:
app.layout = html.Div([
html.Label('indicator A'),
dcc.Checklist(
id = 'i_a',
options=[
{'label': 'a', 'value': 'a'},
{'label': 'b', 'value': 'b'},
{'label': 'c', 'value': 'c'}
],
value = ['a']
),
html.Label('indicator B'),
dcc.Checklist(
id='i_b',
options=[
{'label': '1', 'value': '1'},
{'label': '2', 'value': '2'},
{'label': '3', 'value': '3'}
],
value=['1']
),
])
#app.callback(
Output('i_b', 'value'),
Input('i_a', 'value')
)
def change_b(value_a):
return ['1']
#app.callback(
Output('i_a', 'value'),
Input('i_b', 'value')
)
def change_b(value_b):
return ['a']
This creates an endless loop because the callbacks trigger each other. However, I have no idea how to solve the problem. I am grateful for any help :)
I think what you need is the new circular callbacks ability. Check out the examples on this page, which I think are very similar to what you're doing.

MapPartitions does not execute print

I've a problem that I'm hoping someone can explain it to me.
Let's assume my data looks like this:
('1', ['1', '1', '-1']),
('1', ['1', '2', '-2']),
('1', ['1', '3', '-3']),
('1', ['1', '4', '-4']),
('1', ['1', '5', '-5']),
('1', ['1', '6', '-6']),
('2', ['2', '7', '-7']),
('2', ['2', '8', '-8']),
('2', ['2', '9', '-9'])
and I store it in an RDD with two partitions. One partition contains data for key = '1' and the other contains data for key = '2'. Now, when I run:
def do_something(partition):
print('hello')
for element in partition:
if element[0] != '1':
yield element
my_rdd_new = my_rdd.mapPartitions(do_something)
It doesn't print 'hello' but my_rdd_new contains the right subset of data, i.e.:
('2', ['2', '7', '-7']),
('2', ['2', '8', '-8']),
('2', ['2', '9', '-9'])
Can anyone explain why this is happening?!
If it helps, I'm using spark 2.0.1 and running the code in Jupyter IPython notebook.
Update: It seems Jupyter IPython is the problem. I ran it in the command prompt and it works. Now, the question is: Why does it happen and how it can be fixed?!
Thanks

Why matlab skips 2nd half of labels?

Here is a pretty streightforward code for displaying matrix in scaled color using imagesc command. The problem is that final figure has wrong labeling and doesnt show 2nd half of labels(it should be from 1 to 21, but it is from 1 to 10)
figure;
imagesc(magic(21));
set(gca,'XTickLabel',{'1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21'})
set(gca,'YTickLabel',{'1' '2' '3' '4' '5' '6' '7' '8' '9' '10' '11' '12' '13' '14' '15' '16' '17' '18' '19' '20' '21'})
I am using Ubuntu 16.04 and Matlab 2016b.
You set up the label text, but not the location, thus it will automatically put label locations and then substitute their text.
To set up the locations of the labels, first do:
set(gca,'XTick',...)
Then you can write in those labels whatever you preffer:
set(gca,'XTickLabel',{'banana', 'platano', 'potato',... })
You have to assign locations for those ticks, not just add labels.
figure;
imagesc(magic(21));
ax1 = gca;
ax1.YTick = 1:21;
ax1.XTick = 1:21;
ax1.XTickLabels = {'One','Two','Three',...
ax1.YTickLabels = {'Red','Brown','Green',...
Also since Matlab 2014b Mathworks created a new graphics system. You can access your graphics as objects directly instead of using set and get everywhere.
You can test this:
imagesc(magic(21));
set(gca,'XLim',[1 21])
set(gca,'XTick',[1:1:21])
set(gca,'XTickLabel',{'1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21'})
set(gca,'YLim',[1 21])
set(gca,'YTick',[1:1:21])
set(gca,'YTickLabel',{'1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21'})

PostgreSQL ERROR: INSERT has more target columns than expressions, when it doesn't

So I'm starting with this...
SELECT * FROM parts_finishing;
...I get this...
id, id_part, id_finish, id_metal, id_description, date,
inside_hours_k, inside_rate, outside_material
(0 rows)
...so everything looks fine so far so I do this...
INSERT INTO parts_finishing
(
id_part, id_finish, id_metal, id_description,
date, inside_hours_k, inside_rate, outside_material
) VALUES (
('1013', '6', '30', '1', NOW(), '0', '0', '22.43'),
('1013', '6', '30', '2', NOW(), '0', '0', '32.45'));
...and I get...
ERROR: INSERT has more target columns than expressions
Now I've done a few things like ensuring numbers aren't in quotes, are in quotes (would love a table guide to that in regards to integers, numeric types, etc) after I obviously counted the number of column names and values being inserted. I also tried making sure that all the commas are commas...really at a loss here. There are no other columns except for id which is the bigserial primary key.
Remove the extra () :
INSERT INTO parts_finishing
(
id_part, id_finish, id_metal, id_description,
date, inside_hours_k, inside_rate, outside_material
) VALUES
('1013', '6', '30', '1', NOW(), '0', '0', '22.43')
, ('1013', '6', '30', '2', NOW(), '0', '0', '32.45')
;
the (..., ...) in Postgres is the syntax for a tuple literal; The extra set of ( ) would create a tuple of tuples, which makes no sense.
Also: for numeric literals you don't want the quotes:
(1013, 6, 30, 1, NOW(), 0, 0, 22.43)
, ...
, assuming all these types are numerical.
I had a similar problem when using SQL string composition with psycopg2 in Python, but the problem was slightly different. I was missing a comma after one of the fields.
INSERT INTO parts_finishing
(id_part, id_finish, id_metal)
VALUES (
%(id_part)s <-------------------- missing comma
%(id_finish)s,
%(id_metal)s
);
This caused psycopg2 to yield this error:
ERROR: INSERT has more target columns than expressions.
This happened to me in a large insert, everything was ok (comma-wise), it took me a while to notice I was inserting in the wrong table of course the DB does not know your intentions.
Copy-paste is the root of all evil ... :-)
I faced the same issue as well.It will be raised, when the count of columns given and column values given is mismatched.
I have the same error on express js with PostgreSQL
I Solved it. This is my answer.
error fire at the time of inserting record.
error occurred due to invalid column name with values passing
error: INSERT has more target columns than expressions
ERROR : error: INSERT has more target columns than expressions
name: 'error',
length: 116,
severity: 'ERROR',
code: '42601',
detail: undefined,
hint: undefined,
position: '294',
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'analyze.c',
line: '945',
here is my code dome
INSERT INTO student(
first_name, last_name, email, phone
)
VALUES
($1, $2, $3, $4),
values
: [ first_name,
last_name,
email,
phone ]
IN my case there was syntax error in sub query.

Perl MySQL Cruddy! Assistance

I am fairly new to database programming and am trying to get a basic CRUD app going. Using Cruddy! I have a very limited application that reads the data dictionary and creates forms based on each table.
As several tables have extensive foreign key entries, I want my app to perform the join operations that would be necessary for each foreign key column to be displayed as the entries to which the key refers. Cruddy! claims to have this ability - it uses CGI::AutoForm for the form creation. To get a form up and running, you have to provide entries on a column-by-column basis to a reference table ui_table_column.
Rather than writing SQL statements for all of my tables and their affiliated columns, I'm trying to get the process right for a single column.
From my DDL for this table:
CONSTRAINT `fk_Holder_Sample1`
FOREIGN KEY (`sample_id`)
REFERENCES `sample` (`sample_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
And my attempts at setting up the AutoForm SQL entries:
INSERT INTO ui_table_column (
table_name, field_name, appear_order, heading, searchable, updatable, insertable, input_control_type, multi_insert_delimiter,
search_control_type, search_mult_select, use_data_dict, datatype, default_value, required, input_size, input_maxlength, brief_heading,
alt_mask_field, mask_table_name, mask_field_name, id_field_name, no_cache, radio_checkbox_cols, field_group, element_attrs, help_summary)
VALUES (
'SAMPLE', 'SAMPLE_ID', 10, 'ID', 'Y', 'N', 'N', 'TEXT', NULL,
'SELECT', 4, 'Y', NULL, NULL, NULL, NULL, NULL, NULL,
NULL, 'sample', 'name', 'sample_id', 'Y', NULL, NULL, NULL, NULL);
INSERT INTO ui_table_column (
table_name, field_name, appear_order, heading, searchable, updatable, insertable, input_control_type, multi_insert_delimiter,
search_control_type, search_mult_select, use_data_dict, datatype, default_value, required, input_size, input_maxlength, brief_heading,
alt_mask_field, mask_table_name, mask_field_name, id_field_name, no_cache, radio_checkbox_cols, field_group, element_attrs, help_summary)
VALUES (
'SAMPLE', 'SAMPLE_NAME', 20, 'Name', 'Y', 'Y', 'Y', 'TEXT', NULL,
'MATCH TEXT', NULL, 'Y', NULL, NULL, NULL, NULL, NULL, 'Name',
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO ui_table_column (
table_name, field_name, appear_order, heading, searchable, updatable, insertable, input_control_type, multi_insert_delimiter,
search_control_type, search_mult_select, use_data_dict, datatype, default_value, required, input_size, input_maxlength, brief_heading,
alt_mask_field, mask_table_name, mask_field_name, id_field_name, no_cache, radio_checkbox_cols, field_group, element_attrs, help_summary)
VALUES (
'HOLDER', 'SAMPLE_ID', 30, 'sample', 'Y', 'Y', 'Y', 'SELECT', NULL,
'SELECT', 4, 'Y', NULL, NULL, NULL, NULL, NULL, 'Sample',
NULL, 'sample', 'NAME', 'SAMPLE_ID', 'Y', NULL, NULL, NULL, NULL);
When I refresh my app page (both just refreshing the broswer and calling apachectl) there is no change - that is, I still see Sample ID as a field in the Holder page.
Has anyone had success with this or can advise me on what I'm doing wrong?
EDIT: The silence from SO I take as indicative that this particular framework has not seen widespread use. I would like to open my question up a little, then, and ask what solutions have you used? I am actually experimenting with Catalyst::Plugin::AutoCRUD.
Answered after learner concluded with another framework but for future reference these fields must be in UPPER CASE.
For the example above, the first and third insert statements would have:
(alt_mask_field, mask_table_name, mask_field_name, id_field_name) = (NULL,'SAMPLE','NAME','SAMPLE_ID').
I wound up using the module in my edit. I will flag this as closed tomorrow.