1054 error, unknown column in where clause - mysql-error-1054

I keep getting this error when the column does exist, can anyone tell me why?
This is my query:
update testtable2 set testtable2.BE = testtable1.`1962`
where testtable2.`year`= 1962
and testtable2.PERMNO = testtable1.testcolumn
And I get this response:
Error Code: 1054. Unknown column 'testtable1.testcolumn' in 'where clause'
testtable1 structure:
`testcolumn` varchar(255) DEFAULT NULL,
`FIRSTYEAR` varchar(255) DEFAULT NULL,
`LASTYEAR` varchar(255) DEFAULT NULL,
`1926` varchar(255) DEFAULT NULL,
`1927` varchar(255) DEFAULT NULL,
`1928` varchar(255) DEFAULT NULL,
`1929` varchar(255) DEFAULT NULL,
`1930` varchar(255) DEFAULT NULL,
`1931` varchar(255) DEFAULT NULL,
`1932` varchar(255) DEFAULT NULL,
`1933` varchar(255) DEFAULT NULL,
`1934` varchar(255) DEFAULT NULL,
`1935` varchar(255) DEFAULT NULL,
`1936` varchar(255) DEFAULT NULL,
`1937` varchar(255) DEFAULT NULL,
`1938` varchar(255) DEFAULT NULL,
`1939` varchar(255) DEFAULT NULL,
`1940` varchar(255) DEFAULT NULL,
`1941` varchar(255) DEFAULT NULL,
`1942` varchar(255) DEFAULT NULL,
`1943` varchar(255) DEFAULT NULL,
`1944` varchar(255) DEFAULT NULL,
`1945` varchar(255) DEFAULT NULL,
`1946` varchar(255) DEFAULT NULL,
`1947` varchar(255) DEFAULT NULL,
`1948` varchar(255) DEFAULT NULL,
`1949` varchar(255) DEFAULT NULL,
`1950` varchar(255) DEFAULT NULL,
`1951` varchar(255) DEFAULT NULL,
`1952` varchar(255) DEFAULT NULL,
`1953` varchar(255) DEFAULT NULL,
`1954` varchar(255) DEFAULT NULL,
`1955` varchar(255) DEFAULT NULL,
`1956` varchar(255) DEFAULT NULL,
`1957` varchar(255) DEFAULT NULL,
`1958` varchar(255) DEFAULT NULL,
`1959` varchar(255) DEFAULT NULL,
`1960` varchar(255) DEFAULT NULL,
`1961` varchar(255) DEFAULT NULL,
`1962` varchar(255) DEFAULT NULL,
`1963` varchar(255) DEFAULT NULL,
`1964` varchar(255) DEFAULT NULL,
`1965` varchar(255) DEFAULT NULL,
`1966` varchar(255) DEFAULT NULL,
`1967` varchar(255) DEFAULT NULL,
`1968` varchar(255) DEFAULT NULL,
`1969` varchar(255) DEFAULT NULL,
`1970` varchar(255) DEFAULT NULL,
`1971` varchar(255) DEFAULT NULL,
`1972` varchar(255) DEFAULT NULL,
`1973` varchar(255) DEFAULT NULL,
`1974` varchar(255) DEFAULT NULL,
`1975` varchar(255) DEFAULT NULL,
`1976` varchar(255) DEFAULT NULL,
`1977` varchar(255) DEFAULT NULL,
`1978` varchar(255) DEFAULT NULL,
`1979` varchar(255) DEFAULT NULL,
`1980` varchar(255) DEFAULT NULL,
`1981` varchar(255) DEFAULT NULL,
`1982` varchar(255) DEFAULT NULL,
`1983` varchar(255) DEFAULT NULL,
`1984` varchar(255) DEFAULT NULL,
`1985` varchar(255) DEFAULT NULL,
`1986` varchar(255) DEFAULT NULL,
`1987` varchar(255) DEFAULT NULL,
`1988` varchar(255) DEFAULT NULL,
`1989` varchar(255) DEFAULT NULL,
`1990` varchar(255) DEFAULT NULL,
`1991` varchar(255) DEFAULT NULL,
`1992` varchar(255) DEFAULT NULL,
`1993` varchar(255) DEFAULT NULL,
`1994` varchar(255) DEFAULT NULL,
`1995` varchar(255) DEFAULT NULL,
`1996` varchar(255) DEFAULT NULL,
`1997` varchar(255) DEFAULT NULL,
`1998` varchar(255) DEFAULT NULL,
`1999` varchar(255) DEFAULT NULL,
`2000` varchar(255) DEFAULT NULL,
`2001` varchar(255) DEFAULT NULL,
) ENGINE=InnoDB DEFAULT CHARSET=utf8
testtable2 structure:
`PERMNO` varchar(255) DEFAULT NULL,
`year` varchar(255) DEFAULT NULL,
`BE` varchar(255) DEFAULT NULL

You forgot to join them I think...
update testtable2 tt2
inner join testtable1 tt1 on
tt1.testcolumn = tt2.PERMNO AND tt2.`year`= 1962
set tt2.BE = tt1.`1962`
Or a simpler approach:
update testtable2, testtable1
set testtable2.BE = testtable1.`1962
where testtable2.`year`= 1962
and testtable2.PERMNO = testtable1.testcolumn

Related

Insert Data from Json to multiple SQL tables with FK's

I want to get the data from a single JSON File to my SQL Database with multiple Tables.
This is the JSON File:
{
"Leads":
[
{
"id": "7dc31998-eb32-4171-a118-79837a2950ff",
"productId": "c7f3ba6f-5f8a-4472-8c03-000000000001",
"created": "2020-10-22T07:48:04.318123",
"customer": {
"city": "Hamburg",
"dateOfBirth": "1979-01-01",
"email": "max#mustermann.de",
"firstName": "max",
"netIncome": "FROM_1000_TO_1500",
"number": "123",
"occupation": "EMPLOYEE",
"phone": "+49 171 000 000 00",
"purchasePhase": "EVALUATING",
"street": "Spaldingstr.",
"surName": "mustermann",
"zip": "20097"
},
"request": {
"additionalCosts": 100000,
"brokerageFee": 0.068,
"city": "Stade",
"constructionType": "FOREIGN",
"cost": 500000,
"equity": 200000,
"financingRate": 0.066,
"kfwPromotion": true,
"loan": 400000,
"notaryFee": 0.02,
"realEstateTransferTax": 0.05,
"realEstateType": "APARTMENT",
"realEstateUsage": "RENT",
"zip": "21680"
}
},
{
"id": "7dc31205-eb32-4171-a118-79837a29abcd",
"productId": "c7f3ba6f-5f8a-4472-8c03-000000000001",
"created": "2020-10-23T07:48:04.318123",
"customer": {
"city": "Nürnberg",
"dateOfBirth": "1983-08-16",
"email": "mike#test.com",
"firstName": "Michael",
"netIncome": "FROM_2000_TO_2500",
"number": "123",
"occupation": "EMPLOYEE",
"phone": "+49 171 000 000 00",
"purchasePhase": "EVALUATING",
"street": "Spaldingstr.",
"surName": "mustermann",
"zip": "20097"
},
"request": {
"additionalCosts": 100000,
"brokerageFee": 0.068,
"city": "Stade",
"constructionType": "FOREIGN",
"cost": 500000,
"equity": 200000,
"financingRate": 0.066,
"kfwPromotion": true,
"loan": 400000,
"notaryFee": 0.02,
"realEstateTransferTax": 0.05,
"realEstateType": "APARTMENT",
"realEstateUsage": "RENT",
"zip": "21680"
}
}
]
}
This is my customer Table with customerID as Primary Key:
CREATE TABLE [dbo].[Customer] (
[customerID] INT IDENTITY (1, 1) NOT NULL,
[city] NVARCHAR (50) NULL,
[dateOfBirth] DATE NULL,
[email] NVARCHAR (50) NULL,
[firstName] NVARCHAR (50) NULL,
[netIncome] NVARCHAR (50) NULL,
[number] INT NULL,
[occupation] NVARCHAR (50) NULL,
[phone] NVARCHAR (50) NULL,
[purchasePhase] VARCHAR (50) NULL,
[street] NVARCHAR (50) NULL,
[surName] NVARCHAR (50) NULL,
[zip] INT NULL,
PRIMARY KEY CLUSTERED ([customerID] ASC)
);
The Request Table with requestID as Primary Key:
CREATE TABLE [dbo].[Request] (
[requestID] INT IDENTITY (1, 1) NOT NULL,
[additionalCosts] INT NULL,
[brokerageFee] DECIMAL (18) NULL,
[city] NVARCHAR (50) NULL,
[constructionType] NVARCHAR (50) NULL,
[cost] INT NULL,
[equity] INT NULL,
[financingRate] DECIMAL (18) NULL,
[kfwPromotion] NVARCHAR (50) NULL,
[loan] INT NULL,
[notaryFee] DECIMAL (18) NULL,
[realEstateTransferTax] DECIMAL (18) NULL,
[realEstateType] NVARCHAR (50) NULL,
[realEstateUsage] NVARCHAR (50) NULL,
[zip] INT NULL,
PRIMARY KEY CLUSTERED ([requestID] ASC)
);
the Leads Table:
CREATE TABLE [dbo].[Leads] (
[id] NVARCHAR (50) NOT NULL,
[productID] NVARCHAR (50) NULL,
[created] DATETIME2 (7) NULL,
[customerID] INT NULL,
[requestID] INT NULL,
PRIMARY KEY CLUSTERED ([id] ASC),
CONSTRAINT [FK_Leads_Customer] FOREIGN KEY ([customerID]) REFERENCES [dbo].[Customer] ([customerID]),
CONSTRAINT [FK_Leads_Request] FOREIGN KEY ([requestID]) REFERENCES [dbo].[Request] ([requestID])
);
and my Stored SQL Procedure:
alter Procedure prcInsertCustomer
(#json NVARCHAR(MAX) = '')
AS
BEGIN
DECLARE #LASTcustomerID int = 0
DECLARE #LASTRequestID int = 0
INSERT INTO dbo.Customer
SELECT city, dateOfBirth, email, firstName, netIncome, number, occupation, phone, purchasePhase, street, surName, zip
FROM OPENJSON(#json, '$.Leads')
WITH (
city NVARCHAR(50) '$.customer.city',
dateOfBirth date '$.customer.dateOfBirth',
email NVARCHAR(50) '$.customer.email',
firstName NVARCHAR(50) '$.customer.firstName',
netIncome NVARCHAR(50) '$.customer.netIncome',
number int '$.customer.number',
occupation NVARCHAR(50) '$.customer.occupation',
phone NVARCHAR(50) '$.customer.phone',
purchasePhase NVARCHAR(50) '$.customer.purchasePhase',
street NVARCHAR(50) '$.customer.street',
surName NVARCHAR(50) '$.customer.surName',
zip int '$.customer.zip'
)
SET #LASTcustomerID = IDENT_CURRENT('dbo.customer')
INSERT INTO dbo.Request
SELECT additionalCosts, brokerageFee, city, constructionType, cost, equity, financingRate, kfwPromotion, loan, notaryFee, realEstateTransferTax, realEstateType, realEstateUsage, zip
FROM OPENJSON(#json, '$.Leads')
WITH (
additionalCosts int '$.request.additionalCosts',
brokerageFee decimal(18,0) '$.request.brokerageFee',
city NVARCHAR(50) '$.request.city',
constructionType NVARCHAR(50) '$.request.constructionType',
cost int '$.request.cost',
equity int '$.request.equity',
financingRate decimal(18,0) '$.request.financingRate',
kfwPromotion NVARCHAR(50) '$.request.kfwPromotion',
loan int '$.request.loan',
notaryFee decimal(18,0) '$.request.notaryFee',
realEstateTransferTax decimal(18,0) '$.request.realEstateTransferTax',
realEstateType NVARCHAR(50) '$.request.realEstateType',
realEstateUsage NVARCHAR(50) '$.request.realEstateUsage',
zip int '$.request.zip'
)
SET #LASTRequestID = IDENT_CURRENT('dbo.Request')
INSERT INTO dbo.Leads
SELECT id, productId, created, #LASTcustomerID, #LASTRequestID
FROM OPENJSON(#json, '$.Leads')
WITH (
id NVARCHAR(50) '$.id',
productId NVARCHAR(50) '$.productId',
created datetime2(7) '$.created'
)
END
Now every time I run my stored procedure I have the Same IDs in both Leads:
And I need to proceed all Lead Items from JSON in ONE run.

My updated Azure App Services web app is not served after a successful deploy. How do I fix that?

I built a working node.js Express app using the tutorial "Deploy Express.js to Azure App Service using Visual Studio Code", see:
https://learn.microsoft.com/en-us/azure/developer/javascript/tutorial/deploy-nodejs-azure-app-service-with-visual-studio-code?tabs=bash.
This first version was deployed and worked successfully using only Get requests.
I made some minor changes to include Post requests and deployed that update. This takes 18 minutes to deploy, but the new version is not served to my browser, just the old version. Going to my Azure dashboard and clicking my app service and selecting Browse there, it still shows the old version 2 days after the successful update deploy.
Another problem is that after a long time, say overnight, a request to the app's api does not get answered. My Safari browser says the server stopped responding. But a second request immediately after does get a response, but still with the same old version.
This JSON file may be useful.
{
"id": "/subscriptions/3603adff-9823-408c-980c-ea71f06376ce/resourceGroups/AcesTraderExpress-rg/providers/Microsoft.Web/sites/AcesTraderExpress",
"name": "AcesTraderExpress",
"type": "Microsoft.Web/sites",
"kind": "app,linux",
"location": "East US",
"properties": {
"name": "AcesTraderExpress",
"state": "Running",
"hostNames": [
"acestraderexpress.azurewebsites.net"
],
"webSpace": "AcesTraderExpress-rg-EastUSwebspace-Linux",
"selfLink": "https://waws-prod-blu-217.api.azurewebsites.windows.net:454/subscriptions/3603adff-9823-408c-980c-ea71f06376ce/webspaces/AcesTraderExpress-rg-EastUSwebspace-Linux/sites/AcesTraderExpress",
"repositorySiteName": "AcesTraderExpress",
"owner": null,
"usageState": 0,
"enabled": true,
"adminEnabled": true,
"enabledHostNames": [
"acestraderexpress.azurewebsites.net",
"acestraderexpress.scm.azurewebsites.net"
],
"siteProperties": {
"metadata": null,
"properties": [
{
"name": "LinuxFxVersion",
"value": "NODE|14-lts"
},
{
"name": "WindowsFxVersion",
"value": null
}
],
"appSettings": null
},
"availabilityState": 0,
"sslCertificates": null,
"csrs": [],
"cers": null,
"siteMode": null,
"hostNameSslStates": [
{
"name": "acestraderexpress.azurewebsites.net",
"sslState": 0,
"ipBasedSslResult": null,
"virtualIP": null,
"thumbprint": null,
"toUpdate": null,
"toUpdateIpBasedSsl": null,
"ipBasedSslState": 0,
"hostType": 0
},
{
"name": "acestraderexpress.scm.azurewebsites.net",
"sslState": 0,
"ipBasedSslResult": null,
"virtualIP": null,
"thumbprint": null,
"toUpdate": null,
"toUpdateIpBasedSsl": null,
"ipBasedSslState": 0,
"hostType": 1
}
],
"computeMode": null,
"serverFarm": null,
"serverFarmId": "/subscriptions/3603adff-9823-408c-980c-ea71f06376ce/resourceGroups/AcesTraderExpress-rg/providers/Microsoft.Web/serverfarms/AcesTraderExpress-plan",
"reserved": true,
"isXenon": false,
"hyperV": false,
"lastModifiedTimeUtc": "2021-11-24T21:28:18.1666667",
"storageRecoveryDefaultState": "Running",
"contentAvailabilityState": 0,
"runtimeAvailabilityState": 0,
"siteConfig": {
"numberOfWorkers": 1,
"defaultDocuments": null,
"netFrameworkVersion": null,
"phpVersion": null,
"pythonVersion": null,
"nodeVersion": null,
"powerShellVersion": null,
"linuxFxVersion": "NODE|14-lts",
"windowsFxVersion": null,
"requestTracingEnabled": null,
"remoteDebuggingEnabled": null,
"remoteDebuggingVersion": null,
"httpLoggingEnabled": null,
"azureMonitorLogCategories": null,
"acrUseManagedIdentityCreds": false,
"acrUserManagedIdentityID": null,
"logsDirectorySizeLimit": null,
"detailedErrorLoggingEnabled": null,
"publishingUsername": null,
"publishingPassword": null,
"appSettings": null,
"metadata": null,
"connectionStrings": null,
"machineKey": null,
"handlerMappings": null,
"documentRoot": null,
"scmType": null,
"use32BitWorkerProcess": null,
"webSocketsEnabled": null,
"alwaysOn": false,
"javaVersion": null,
"javaContainer": null,
"javaContainerVersion": null,
"appCommandLine": null,
"managedPipelineMode": null,
"virtualApplications": null,
"winAuthAdminState": null,
"winAuthTenantState": null,
"customAppPoolIdentityAdminState": null,
"customAppPoolIdentityTenantState": null,
"runtimeADUser": null,
"runtimeADUserPassword": null,
"loadBalancing": null,
"routingRules": null,
"experiments": null,
"limits": null,
"autoHealEnabled": null,
"autoHealRules": null,
"tracingOptions": null,
"vnetName": null,
"vnetRouteAllEnabled": null,
"vnetPrivatePortsCount": null,
"publicNetworkAccess": null,
"cors": null,
"push": null,
"apiDefinition": null,
"apiManagementConfig": null,
"autoSwapSlotName": null,
"localMySqlEnabled": null,
"managedServiceIdentityId": null,
"xManagedServiceIdentityId": null,
"keyVaultReferenceIdentity": null,
"ipSecurityRestrictions": null,
"scmIpSecurityRestrictions": null,
"scmIpSecurityRestrictionsUseMain": null,
"http20Enabled": false,
"minTlsVersion": null,
"scmMinTlsVersion": null,
"ftpsState": null,
"preWarmedInstanceCount": null,
"functionAppScaleLimit": 0,
"healthCheckPath": null,
"fileChangeAuditEnabled": null,
"functionsRuntimeScaleMonitoringEnabled": null,
"websiteTimeZone": null,
"minimumElasticInstanceCount": 0,
"azureStorageAccounts": null,
"sitePort": null
},
"deploymentId": "AcesTraderExpress",
"slotName": null,
"trafficManagerHostNames": null,
"sku": "Free",
"scmSiteAlsoStopped": false,
"targetSwapSlot": null,
"hostingEnvironment": null,
"hostingEnvironmentProfile": null,
"clientAffinityEnabled": true,
"clientCertEnabled": false,
"clientCertMode": 0,
"clientCertExclusionPaths": null,
"hostNamesDisabled": false,
"domainVerificationIdentifiers": null,
"customDomainVerificationId": "32CA73F9034F12CA2A538C5F30E96A3BDF81DFD04981F8BFE65F69C4E24A69E6",
"kind": "app,linux",
"inboundIpAddress": "20.49.104.15",
"possibleInboundIpAddresses": "20.49.104.15",
"ftpUsername": "AcesTraderExpress\\$AcesTraderExpress",
"ftpsHostName": "ftps://waws-prod-blu-217.ftp.azurewebsites.windows.net/site/wwwroot",
"outboundIpAddresses": "40.76.167.202,52.146.70.44,52.146.70.103,52.146.68.209,52.146.68.246,52.146.69.57,20.49.104.15",
"possibleOutboundIpAddresses": "40.76.167.202,52.146.70.44,52.146.70.103,52.146.68.209,52.146.68.246,52.146.69.57,52.146.70.115,52.146.70.118,52.146.70.158,52.146.66.148,52.146.71.5,40.76.165.150,40.76.167.156,40.76.167.157,52.146.68.142,52.146.64.68,52.146.65.22,52.146.65.23,52.191.239.27,52.191.239.78,52.191.239.120,52.224.200.31,52.224.201.90,52.224.202.78,20.49.104.15",
"containerSize": 0,
"dailyMemoryTimeQuota": 0,
"suspendedTill": null,
"siteDisabledReason": 0,
"functionExecutionUnitsCache": null,
"maxNumberOfWorkers": null,
"homeStamp": "waws-prod-blu-217",
"cloningInfo": null,
"hostingEnvironmentId": null,
"tags": null,
"resourceGroup": "AcesTraderExpress-rg",
"defaultHostName": "acestraderexpress.azurewebsites.net",
"slotSwapStatus": null,
"httpsOnly": false,
"redundancyMode": 0,
"inProgressOperationId": null,
"geoDistributions": null,
"privateEndpointConnections": [],
"buildVersion": null,
"targetBuildVersion": null,
"migrationState": null,
"eligibleLogCategories": "AppServiceAppLogs,AppServiceAuditLogs,AppServiceConsoleLogs,AppServiceHTTPLogs,AppServiceIPSecAuditLogs,AppServicePlatformLogs,ScanLogs",
"storageAccountRequired": false,
"virtualNetworkSubnetId": null,
"keyVaultReferenceIdentity": "SystemAssigned"
}
}
I am following this website. Initially I am added only Get request and deployed to azure portal using this doc Deploy Node.js Express.js to App Service from Visual Studio Code - Azure | Microsoft Docs.
(Note: Skipped the Local git deployment process).
Directly deployed using Deploy to Web app in Visual Studio Code
Then, I am adding the below code in visual studio with Post Request
Add below code in app.js
const express = require("express");
const port = process.env.PORT || 3000
const bodyParser = require("body-parser")
// App using express node module
const app = express();
app.use(bodyParser.urlencoded({
extended:true
}));
// Get request
app.get("/", function(req, res) {
res.sendFile(__dirname + "/index.html");
});
// Post Request
app.post("/", function(req, res) {
var num1 = Number(req.body.num1);
var num2 = Number(req.body.num2);
var result = num1 + num2 ;
res.send("Addition - " + result);
});
app.listen(port, function(){
console.log('server is running on port 3000');
})
Added the below code in index.html
< !DOCTYPE html>
< html lang="en" dir="ltr">
< head>
< meta charset="utf-8">
< title>Calculator</title>
< /head>
< body>
< h1>Simple Calculator.< /h1>
< form action="/" method="post">
< input type="text" name="num1" placeholder="First Number">
< input type="text" name="num2" placeholder="Second Number">
< button type="submit" name="submit">
calculator
< /button>
< /form>
< /body>
< /html>
After added Post Method request, I was deployed again in a Azure Web App. (By Default it was deployed in Linux app service).
I can view the results in Browser

How do I join 3 tables with different columns? Getting data type error SQL Big Query

I am trying to create a view from 3 different tables. I keep getting an error 'Column 2 in UNION DISTINCT has incompatible types: INT64, STRING, STRING at [165:1]'
What am I doing wrong? The line 165:1 where it is flagging is when the next table starts. Is there a better way to merge 3 tables with different columns?
Below is script for the view
SELECT Date,
Active_View_Impressions__AdWords,
Active_View_Measurable_Cost__AdWords,
Active_View_Measurable_Impressions__AdWords,
All_Conv___AdWords,
SPLIT(Campaign__AdWords,'|')[safe_ordinal(1)] as Location,SPLIT(Campaign__AdWords,'|')[safe_ordinal(2)] as Market_Type,
Click_Assisted_Conv___AdWords,
Clicks__AdWords,
Conversions__AdWords,
Cost__AdWords,
Data_Source_id,
Data_Source_type,
Device__AdWords,
Engagements__AdWords,
Impr__Assisted_Conv___AdWords,
Impressions__AdWords,
Interactions__AdWords,
Invalid_Clicks__AdWords,
Network_With_Search_Params__AdWords,
Total_absolute_top_impressions__AdWords,
Total_Position__AdWords,
Total_top_impressions__AdWords,
Video_views__AdWords,
View_through_Conv___AdWords,
Views__AdWords,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
FROM`inbr.Adwords_02.all_funnel_data_view` 
UNION DISTINCT
SELECT Date,
Data_Source_id,
Data_Source_type,
Actions__Facebook_Ads,
Amount_Spent__Facebook_Ads,
Attribution_Window__Facebook_Ads,
Buying_Type__Facebook_Ads,
SPLIT(Campaign_Name__Facebook_Ads,'|')[safe_ordinal(1)] as Market,SPLIT(Campaign_Name__Facebook_Ads,'|')[safe_ordinal(2)] as Market_Type,
Campaign_Objective__Facebook_Ads,
Check_ins__Facebook_Ads,
Clicks_all__Facebook_Ads,
Event_Responses__Facebook_Ads,
Impressions__Facebook_Ads,
Link_Clicks__Facebook_Ads,
n_10_Second_Video_Views__Facebook_Ads,
n_3_Second_Video_Views__Facebook_Ads,
Outbound_Clicks__Facebook_Ads,
Page_Engagement__Facebook_Ads,
Page_Likes__Facebook_Ads,
Page_Mentions__Facebook_Ads,
Page_Tab_Views__Facebook_Ads,
Photo_Views__Facebook_Ads,
Post_Comments__Facebook_Ads,
Post_Engagement__Facebook_Ads,
Post_Reactions__Facebook_Ads,
Post_Shares__Facebook_Ads,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
FROM`inbr.Facebook_Ads_02.all_funnel_data_view`
UNION DISTINCT 
SELECT CAST(Date AS DATE) Date,
Data_Source_type,
Data_Source_id,
Campaign,
Data_Source,
Data_Source_name,
Data_Source_type_name,
Ad_legacy__AdWords,
Ad_Group_Name__AdWords,
Ad_Type__AdWords,
SPLIT(Campaign__AdWords,'|')[safe_ordinal(1)] as Market,SPLIT(Campaign__AdWords,'|')[safe_ordinal(2)] as Market_Type,
City__AdWords,
Description__AdWords,
Description_Line_1__AdWords,
Description_Line_2__AdWords,
Device__AdWords,
Expanded_Text_Ad_Description_2__AdWords,
Expanded_Text_Ad_Headline_3__AdWords,
Headline_1__AdWords,
Headline_2__AdWords,
KeywordPlacement__AdWords,
Metro__AdWords,
Network__AdWords,
Network_With_Search_Params__AdWords,
Quality_Score__AdWords,
Region__AdWords,
Clicks__AdWords,
Cost__AdWords,
Engagements__AdWords,
Impressions__AdWords,
Interactions__AdWords,
Invalid_Clicks__AdWords,
Total_absolute_top_impressions__AdWords,
Total_Position__AdWords,
Total_top_impressions__AdWords,
Video_views__AdWords,
Views__AdWords,
Video_impressions__AdWords,
Views_100__AdWords,
Active_View_Impressions__AdWords,
Active_View_Measurable_Cost__AdWords,
Active_View_Measurable_Impressions__AdWords,
All_Conv___AdWords,
Click_Assisted_Conv___AdWords,
Conversions__AdWords,
Impr__Assisted_Conv___AdWords,
SmileSnap_Button_Click_mo_tid_Med___inbr___AdWords_Keyword__AdWords,
Thank_You_Form_mo_tid_Med___inbr___AdWords_Keyword__AdWords,
View_through_Conv___AdWords,
Ad_Name__Facebook_Ads,
Ad_Set_Name__Facebook_Ads,
Age__Facebook_Ads,
Attribution_Window__Facebook_Ads,
Buying_Type__Facebook_Ads,
Campaign_Name__Facebook_Ads,
Campaign_Objective__Facebook_Ads,
Conversion_Device__Facebook_Ads,
Device_Platform__Facebook_Ads,
DMA_Region__Facebook_Ads,
Impression_Device__Facebook_Ads,
Link__Facebook_Ads,
Placement__Facebook_Ads,
Gender__Facebook_Ads,
Platform__Facebook_Ads,
n_10_Second_Video_Views__Facebook_Ads,
n_3_Second_Video_Views__Facebook_Ads,
n_30_Second_Video_Views__Facebook_Ads,
Video_Plays__Facebook_Ads,
Video_thruplay__Facebook_Ads,
Video_Watches_at_100__Facebook_Ads,
Video_Watches_at_25__Facebook_Ads,
Video_Watches_at_50__Facebook_Ads,
Video_Watches_at_75__Facebook_Ads,
Video_Watches_at_95__Facebook_Ads,
Button_Clicks__Facebook_Ads,
Link_Clicks__Facebook_Ads,
Outbound_Clicks__Facebook_Ads,
Check_ins__Facebook_Ads,
Event_Responses__Facebook_Ads,
Page_Engagement__Facebook_Ads,
Page_Likes__Facebook_Ads,
Page_Mentions__Facebook_Ads,
Page_Tab_Views__Facebook_Ads,
Photo_Views__Facebook_Ads,
Post_Comments__Facebook_Ads,
Post_Engagement__Facebook_Ads,
Post_Reactions__Facebook_Ads,
Post_Shares__Facebook_Ads,
Actions__Facebook_Ads,
Amount_Spent__Facebook_Ads,
Clicks_all__Facebook_Ads,
Impressions__Facebook_Ads,
Thank_You_Form_mo_tid_Med___inbr___Facebook_Conversion__Facebook_Ads,
Thank_You_Form_V2_mo_tid_Med___inbr___Facebook_Conversion__Facebook_Ads,
n_100_In_View_Impressions__Facebook_Ads,
Custom_Events__Facebook_Ads,
Landing_Page_Views__Facebook_Ads,
Leads__Facebook_Ads,
Leads_Form__Facebook_Ads,
Ad_Group_ID__The_Trade,
Ad_Group_Name__The_Trade,
Advertiser_ID__The_Trade,
Advertiser_Name__The_Trade,
Advertiser_Total_Cost__The_Trade,
Partner_Cost__The_Trade_1,
Bids__The_Trade,
Campaign_ID__The_Trade,
Campaign_Name__The_Trade,
Clicks__The_Trade,
Impressions__The_Trade,
Partner_ID__The_Trade,
Site__The_Trade,
City__The_Trade,
Country__The_Trade,
Metro__The_Trade,
Region__The_Trade,
Player_25_Complete__The_Trade,
Player_50_Complete__The_Trade,
Player_75_Complete__The_Trade,
Player_Close__The_Trade,
Player_Collapse__The_Trade,
Player_Completed_Views__The_Trade,
Player_Engaged_Views__The_Trade,
Player_Error__The_Trade,
Player_Expansion__The_Trade,
Player_Full_Screen__The_Trade,
Player_Invitation_Accept__The_Trade,
Player_Mute__The_Trade,
Player_Pause__The_Trade,
Player_Resume__The_Trade,
Player_Rewind__The_Trade,
Player_Skip__The_Trade,
Player_Starts__The_Trade,
Player_Unmute__The_Trade,
Player_Views__The_Trade,
Video_Was_Trackable__The_Trade,
Video_Was_Viewable__The_Trade,
n_01___Click_Conversion__The_Trade,
n_02___Click_Conversion__The_Trade,
n_03___Click_Conversion__The_Trade,
n_04___Click_Conversion__The_Trade,
n_05___Click_Conversion__The_Trade,
n_06___Click_Conversion__The_Trade,
n_01___Time_Weighted_Decay_Conversion__The_Trade,
n_02___Time_Weighted_Decay_Conversion__The_Trade,
n_03___Time_Weighted_Decay_Conversion__The_Trade,
n_04___Time_Weighted_Decay_Conversion__The_Trade,
n_05___Time_Weighted_Decay_Conversion__The_Trade,
n_06___Time_Weighted_Decay_Conversion__The_Trade,
n_01___View_Through_Conversion__The_Trade,
n_02___View_Through_Conversion__The_Trade,
n_03___View_Through_Conversion__The_Trade,
n_04___View_Through_Conversion__The_Trade,
n_05___View_Through_Conversion__The_Trade,
n_06___View_Through_Conversion__The_Trade,
n_01___Conversion_Touch__The_Trade,
n_02___Conversion_Touch__The_Trade,
n_03___Conversion_Touch__The_Trade,
n_04___Conversion_Touch__The_Trade,
n_05___Conversion_Touch__The_Trade,
n_06___Conversion_Touch__The_Trade
FROM`inbr.AX_Trade.AX_Trade` ```
According to error message there are type mismatch for column 2 in three tables. So, I have casted second column of first table as string. Please check now.
SELECT Date,
cast(Active_View_Impressions__AdWords as string),
Active_View_Measurable_Cost__AdWords,
Active_View_Measurable_Impressions__AdWords,
All_Conv___AdWords,
SPLIT(Campaign__AdWords,'|')[safe_ordinal(1)] as Location,SPLIT(Campaign__AdWords,'|')[safe_ordinal(2)] as Market_Type,
Click_Assisted_Conv___AdWords,
Clicks__AdWords,
Conversions__AdWords,
Cost__AdWords,
Data_Source_id,
Data_Source_type,
Device__AdWords,
Engagements__AdWords,
Impr__Assisted_Conv___AdWords,
Impressions__AdWords,
Interactions__AdWords,
Invalid_Clicks__AdWords,
Network_With_Search_Params__AdWords,
Total_absolute_top_impressions__AdWords,
Total_Position__AdWords,
Total_top_impressions__AdWords,
Video_views__AdWords,
View_through_Conv___AdWords,
Views__AdWords,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
FROM`inbr.Adwords_02.all_funnel_data_view`
UNION DISTINCT
SELECT Date,
Data_Source_id,
Data_Source_type,
Actions__Facebook_Ads,
Amount_Spent__Facebook_Ads,
Attribution_Window__Facebook_Ads,
Buying_Type__Facebook_Ads,
SPLIT(Campaign_Name__Facebook_Ads,'|')[safe_ordinal(1)] as Market,SPLIT(Campaign_Name__Facebook_Ads,'|')[safe_ordinal(2)] as Market_Type,
Campaign_Objective__Facebook_Ads,
Check_ins__Facebook_Ads,
Clicks_all__Facebook_Ads,
Event_Responses__Facebook_Ads,
Impressions__Facebook_Ads,
Link_Clicks__Facebook_Ads,
n_10_Second_Video_Views__Facebook_Ads,
n_3_Second_Video_Views__Facebook_Ads,
Outbound_Clicks__Facebook_Ads,
Page_Engagement__Facebook_Ads,
Page_Likes__Facebook_Ads,
Page_Mentions__Facebook_Ads,
Page_Tab_Views__Facebook_Ads,
Photo_Views__Facebook_Ads,
Post_Comments__Facebook_Ads,
Post_Engagement__Facebook_Ads,
Post_Reactions__Facebook_Ads,
Post_Shares__Facebook_Ads,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
FROM`inbr.Facebook_Ads_02.all_funnel_data_view`
UNION DISTINCT
SELECT CAST(Date AS DATE) Date,
Data_Source_type,
Data_Source_id,
Campaign,
Data_Source,
Data_Source_name,
Data_Source_type_name,
Ad_legacy__AdWords,
Ad_Group_Name__AdWords,
Ad_Type__AdWords,
SPLIT(Campaign__AdWords,'|')[safe_ordinal(1)] as Market,SPLIT(Campaign__AdWords,'|')[safe_ordinal(2)] as Market_Type,
City__AdWords,
Description__AdWords,
Description_Line_1__AdWords,
Description_Line_2__AdWords,
Device__AdWords,
Expanded_Text_Ad_Description_2__AdWords,
Expanded_Text_Ad_Headline_3__AdWords,
Headline_1__AdWords,
Headline_2__AdWords,
KeywordPlacement__AdWords,
Metro__AdWords,
Network__AdWords,
Network_With_Search_Params__AdWords,
Quality_Score__AdWords,
Region__AdWords,
Clicks__AdWords,
Cost__AdWords,
Engagements__AdWords,
Impressions__AdWords,
Interactions__AdWords,
Invalid_Clicks__AdWords,
Total_absolute_top_impressions__AdWords,
Total_Position__AdWords,
Total_top_impressions__AdWords,
Video_views__AdWords,
Views__AdWords,
Video_impressions__AdWords,
Views_100__AdWords,
Active_View_Impressions__AdWords,
Active_View_Measurable_Cost__AdWords,
Active_View_Measurable_Impressions__AdWords,
All_Conv___AdWords,
Click_Assisted_Conv___AdWords,
Conversions__AdWords,
Impr__Assisted_Conv___AdWords,
SmileSnap_Button_Click_mo_tid_Med___inbr___AdWords_Keyword__AdWords,
Thank_You_Form_mo_tid_Med___inbr___AdWords_Keyword__AdWords,
View_through_Conv___AdWords,
Ad_Name__Facebook_Ads,
Ad_Set_Name__Facebook_Ads,
Age__Facebook_Ads,
Attribution_Window__Facebook_Ads,
Buying_Type__Facebook_Ads,
Campaign_Name__Facebook_Ads,
Campaign_Objective__Facebook_Ads,
Conversion_Device__Facebook_Ads,
Device_Platform__Facebook_Ads,
DMA_Region__Facebook_Ads,
Impression_Device__Facebook_Ads,
Link__Facebook_Ads,
Placement__Facebook_Ads,
Gender__Facebook_Ads,
Platform__Facebook_Ads,
n_10_Second_Video_Views__Facebook_Ads,
n_3_Second_Video_Views__Facebook_Ads,
n_30_Second_Video_Views__Facebook_Ads,
Video_Plays__Facebook_Ads,
Video_thruplay__Facebook_Ads,
Video_Watches_at_100__Facebook_Ads,
Video_Watches_at_25__Facebook_Ads,
Video_Watches_at_50__Facebook_Ads,
Video_Watches_at_75__Facebook_Ads,
Video_Watches_at_95__Facebook_Ads,
Button_Clicks__Facebook_Ads,
Link_Clicks__Facebook_Ads,
Outbound_Clicks__Facebook_Ads,
Check_ins__Facebook_Ads,
Event_Responses__Facebook_Ads,
Page_Engagement__Facebook_Ads,
Page_Likes__Facebook_Ads,
Page_Mentions__Facebook_Ads,
Page_Tab_Views__Facebook_Ads,
Photo_Views__Facebook_Ads,
Post_Comments__Facebook_Ads,
Post_Engagement__Facebook_Ads,
Post_Reactions__Facebook_Ads,
Post_Shares__Facebook_Ads,
Actions__Facebook_Ads,
Amount_Spent__Facebook_Ads,
Clicks_all__Facebook_Ads,
Impressions__Facebook_Ads,
Thank_You_Form_mo_tid_Med___inbr___Facebook_Conversion__Facebook_Ads,
Thank_You_Form_V2_mo_tid_Med___inbr___Facebook_Conversion__Facebook_Ads,
n_100_In_View_Impressions__Facebook_Ads,
Custom_Events__Facebook_Ads,
Landing_Page_Views__Facebook_Ads,
Leads__Facebook_Ads,
Leads_Form__Facebook_Ads,
Ad_Group_ID__The_Trade,
Ad_Group_Name__The_Trade,
Advertiser_ID__The_Trade,
Advertiser_Name__The_Trade,
Advertiser_Total_Cost__The_Trade,
Partner_Cost__The_Trade_1,
Bids__The_Trade,
Campaign_ID__The_Trade,
Campaign_Name__The_Trade,
Clicks__The_Trade,
Impressions__The_Trade,
Partner_ID__The_Trade,
Site__The_Trade,
City__The_Trade,
Country__The_Trade,
Metro__The_Trade,
Region__The_Trade,
Player_25_Complete__The_Trade,
Player_50_Complete__The_Trade,
Player_75_Complete__The_Trade,
Player_Close__The_Trade,
Player_Collapse__The_Trade,
Player_Completed_Views__The_Trade,
Player_Engaged_Views__The_Trade,
Player_Error__The_Trade,
Player_Expansion__The_Trade,
Player_Full_Screen__The_Trade,
Player_Invitation_Accept__The_Trade,
Player_Mute__The_Trade,
Player_Pause__The_Trade,
Player_Resume__The_Trade,
Player_Rewind__The_Trade,
Player_Skip__The_Trade,
Player_Starts__The_Trade,
Player_Unmute__The_Trade,
Player_Views__The_Trade,
Video_Was_Trackable__The_Trade,
Video_Was_Viewable__The_Trade,
n_01___Click_Conversion__The_Trade,
n_02___Click_Conversion__The_Trade,
n_03___Click_Conversion__The_Trade,
n_04___Click_Conversion__The_Trade,
n_05___Click_Conversion__The_Trade,
n_06___Click_Conversion__The_Trade,
n_01___Time_Weighted_Decay_Conversion__The_Trade,
n_02___Time_Weighted_Decay_Conversion__The_Trade,
n_03___Time_Weighted_Decay_Conversion__The_Trade,
n_04___Time_Weighted_Decay_Conversion__The_Trade,
n_05___Time_Weighted_Decay_Conversion__The_Trade,
n_06___Time_Weighted_Decay_Conversion__The_Trade,
n_01___View_Through_Conversion__The_Trade,
n_02___View_Through_Conversion__The_Trade,
n_03___View_Through_Conversion__The_Trade,
n_04___View_Through_Conversion__The_Trade,
n_05___View_Through_Conversion__The_Trade,
n_06___View_Through_Conversion__The_Trade,
n_01___Conversion_Touch__The_Trade,
n_02___Conversion_Touch__The_Trade,
n_03___Conversion_Touch__The_Trade,
n_04___Conversion_Touch__The_Trade,
n_05___Conversion_Touch__The_Trade,
n_06___Conversion_Touch__The_Trade
FROM`inbr.AX_Trade.AX_Trade

How Odoo store `res.config.settings`? It looks it saved but not presented in `res.config.settings` and `ir.config_parameter`

https://www.odoo.com/forum/help-1/question/12-0-enable-features-in-the-res-config-settings-149566
I have created my setting data file as the followings mentioned by Alexander inside the page above:
res_config_data.xml
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="my_config_settings" model="res.config.settings">
<field name="company_id" ref="base.main_company"/>
<field name="group_multi_currency" eval="True"/>
<field name="group_product_variant" eval="True"/>
<field name="group_stock_multi_warehouses" eval="True"/>
<field name="group_stock_multi_locations" eval="True"/>
<!-- Delivery Packages -->
<field name="group_stock_tracking_lot" eval="True" />
<field name="module_stock_picking_batch" eval="True" />
<!-- Display Lots & Serial Numbers: Lots & Serial numbers will appear on the delivery slip -->
<field name="group_lot_on_delivery_slip" eval="True" />
<!-- Multi-Step Routes: Use your own routes and putaway strategies -->
<field name="group_stock_adv_location" eval="True" />
<field name="po_order_approval" eval="True" />
<!-- Quantities billed by vendors -->
<field name="default_purchase_method">purchase</field>
<field name="multi_sales_price" eval="True" />
<!-- Multiple prices per product -->
<field name="multi_sales_price_method">percentage</field>
<field name="group_analytic_tags" eval="True" />
<field name="group_analytic_accounting" eval="True" />
<!-- Set specific billing and shipping addresses -->
<field name="group_sale_delivery_address" eval="True" />
<!-- Consignment -->
<field name="group_stock_tracking_owner" eval="True" />
<!-- Prepayment -->
<field name="prepayment_account_id" ref="my_chart_of_account.my_account_prepayments" />
<!-- Multi-company-->
<field name="group_multi_company" eval="False" />
</record>
<function model="res.config.settings" name="execute">
<value model="res.config.settings"
search="[('id', '=', ref('my_config_settings'))]"/>
</function>
</odoo>
__manifest__.py
'data': [
'data/res_config_data.xml',
],
It works if I apply it once only. But when I try to reinstall this setting module, it will not work.
It somehow fails to recognize what fields are the supported.
2020-06-11 02:26:48,117 52288 WARNING odoo_dev odoo.models: res.config.settings.create() with unknown fields: company_id, default_purchase_method, group_analytic_accounting, group_analytic_tags, group_lot_on_delivery_slip, group_multi_company, group_multi_currency, group_product_variant, group_sale_delivery_address, group_stock_adv_location, group_stock_multi_locations, group_stock_multi_warehouses, group_stock_tracking_lot, group_stock_tracking_owner, module_stock_picking_batch, multi_sales_price, multi_sales_price_method, po_order_approval, prepayment_account_id
Odoo discarded these unrecognized fields and insert the plain object into DB
2020-06-11 02:26:48,118 52288 ERROR odoo_dev odoo.sql_db: bad query: b'INSERT INTO "res_config_settings" ("id", "create_uid", "create_date", "write_uid", "write_date") VALUES (nextval(\'res_config_settings_id_seq\'), 1, (now() at time zone \'UTC\'), 1, (now() at time zone \'UTC\')) RETURNING id'
ERROR: null value in column "company_id" violates not-null constraint
DETAIL: Failing row contains (10, 1, 2020-06-11 02:26:47.302998, 1, 2020-06-11 02:26:47.302998, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null).
psycopg2.IntegrityError: null value in column "company_id" violates not-null constraint
DETAIL: Failing row contains (10, 1, 2020-06-11 02:26:47.302998, 1, 2020-06-11 02:26:47.302998, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null).
When I installed this setting module with a brand new Odoo database, and I go to general setting page, I can see the settings are installed. But when I check res.config.settings and ir.config_parameter tables, I don't see any settings record stored. I want to understand how this setting data file being proceeded and stored in where.
Ok although I still have no idea how settings being saved by Odoo. I managed to fix the update setting error.
The reason why it states res.config.settings.create() with unknown fields is because I was trying to update setting that are belongs to different module. For example group_multi_company is under base_setup. However in my setting module I have not listed base_setup as the dependencies.
After putting all modules for those settings I was trying to set, I can update settings properly. Yes if you do not add these dependencies it is still installable but for the first time only, yet you won't be able to update data later on. So always list all related dependent modules.
# -*- coding: utf-8 -*-
{
'name': "My Odoo Settings",
'description': "My configuration for setup",
'version': '12.0.2',
'author': "Wow Ltd.",
'website': "https://github.com/o.o/odoo-addons",
'summary': "My configuration for setup",
# Here, originally I have set with [] only.
# With these I can now update settings successfully
'depends': ['base_setup', 'sale', 'account', 'purchase', 'stock', 'stock_account', 'sale_management'],
'data': [
'data/settings.xml',
],
'installable': True,
}

How can I speed up a clustered index scan on 1.6 million rows?

I have a table with over 1.6 million records. (Create statement below.) I join to it in a query, using the Primary key, and the query takes 4 seconds, with 61% of that used on a Clustered index scan on this table.
Here is a sample of the query:
DECLARE #pintDueBy DATETIME = '1/1/1900',
#pintCounty INT = 0
SET #pintDueBy = N'10/30/14'
SET #pintCounty = 42043
SELECT
ISNULL(Eqp.ELOFLNUM,0) AS ELOFLNUM
,ISNULL(Eqp.ELERPNUM, 0) AS ELERPNUM
,ISNULL(CASE
WHEN Eqp.ELERPNUM IS NULL OR Eqp.ELERPNUM = 0 THEN Eqp.ELOFLNUM
ELSE Eqp.ELERPNUM
END, 0) AS OwnFLNUM
,ISNULL(RpOwn.T_AS400_ELVPOWN00_ID,0) AS RespOwn_ID
,ISNULL(Eqp.ELBLDGCD,0) AS ELBLDGCD
,ISNULL(Eqp.ELEEQNO,0) AS ELEEQNO
,ISNULL(Eqp.ELPERMTNO,0) AS ELPERMTNO
,ISNULL(Eqp.ELEPERMID,'') AS ELEPERMID
,ISNULL(ELEYCEXP,0) AS ELEYCEXP
,ISNULL(ELEMCEXP,0) AS ELEMCEXP
, BOISdbo.UDF_PARSE_DATE_FIELDS(NULL,ELEYCEXP,ELEMCEXP,99) AS ELECertExp
, BOISdbo.UDF_PARSE_DATE_FIELDS(NULL,LastInsp.ELDTINSYY,LastInsp.ELDTINSMM,LastInsp.ELDTINSDD) AS LastSeen
, ISNULL(LastInsp.ELERSLT1, '') AS LastSeenResult
,Eqp.T_AS400_ELVPEQP00_ID AS EqpID
,ISNULL(Eqp.ELEECOCD_ID,0) AS ELEECOCD_ID
,ISNULL(Eqp.ELEEORIG_ID,0) AS ELEEORIG_ID
,ISNULL(Eqp.LAST_INSPTN_ID,0) AS LAST_INSPTN_ID
, ISNULL(LastInsp.INVID,0) AS INVID
FROM dbo.T_AS400_ELVPEQP00 AS Eqp
LEFT JOIN dbo.T_AS400_ELVPLOC00 AS Loc
ON Eqp.ELBLDGCD = Loc.ELBLDGCD
LEFT JOIN dbo.T_AS400_ELVPOWN00 AS RpOwn
ON CASE
WHEN Eqp.ELERPNUM IS NULL OR Eqp.ELERPNUM = 0 THEN Eqp.ELOFLNUM
ELSE Eqp.ELERPNUM
END = RpOwn.ELOFLNUM
LEFT JOIN dbo.T_AS400_ELVPINS00 AS LastInsp
ON Eqp.LAST_INSPTN_ID = LastInsp.T_AS400_ELVPINS00_ID
LEFT JOIN BOISdbo.UV_COUNTY_LIST AS cnty
ON cnty.REF_VALUE = Loc.ELLCNTY
WHERE
Loc.ELLSTATS IN ('O') -- O - Occupied
AND
ISNULL(LastInsp.ELERSLT1, '') NOT IN ('O') -- O - Out of Service
AND
(#pintCounty = 0 OR cnty.REF_VALUE = #pintCounty)
My output list for this query only uses 6 of the fields:
[BOIS].[dbo].[T_AS400_ELVPINS00].ELDTINSYY
[BOIS].[dbo].[T_AS400_ELVPINS00].ELDTINSMM
[BOIS].[dbo].[T_AS400_ELVPINS00].ELDTINSDD
[BOIS].[dbo].[T_AS400_ELVPINS00].ELERSLT1
[BOIS].[dbo].[T_AS400_ELVPINS00].T_AS400_ELVPINS00_ID
[BOIS].[dbo].[T_AS400_ELVPINS00].INVID
Any ideas?
CREATE TABLE [dbo].[T_AS400_ELVPINS00](
[ELBLDGCD] [int] NULL,
[ELEEQNO] [int] NULL,
[ELDTINSYY] [int] NULL,
[ELDTINSMM] [int] NULL,
[ELDTINSDD] [int] NULL,
[ELINSCD] [varchar](6) NULL,
[ELFEECO] [varchar](6) NULL,
[ELIINSR] [varchar](6) NULL,
[ELERSLT1] [varchar](1) NULL,
[ELDTIBYY] [int] NULL,
[ELDTIBMM] [int] NULL,
[ELDTIBDD] [int] NULL,
[ELECRDTYY] [int] NULL,
[ELECRDTMM] [int] NULL,
[ELECRDTDD] [int] NULL,
[ELTINSP] [varchar](1) NULL,
[ELECNUM] [int] NULL,
[ELEFEE] [decimal](18, 0) NULL,
[ELEBILL] [varchar](1) NULL,
[ELDUPCT] [varchar](1) NULL,
[ELDTDUPYY] [int] NULL,
[ELDTDUPMM] [int] NULL,
[ELDTDUPDD] [int] NULL,
[ELEFLG] [varchar](1) NULL,
[ELFORCD] [varchar](1) NULL,
[ELEINV] [varchar](8) NULL,
[ELELSEAL] [varchar](1) NULL,
[ELELSDTY] [int] NULL,
[ELELSDTM] [int] NULL,
[ELELSDTD] [int] NULL,
[ELELSNUM] [int] NULL,
[ELREMVYY] [int] NULL,
[ELREMVMM] [int] NULL,
[ELREMVDD] [int] NULL,
[ELEDFNCS] [varchar](1) NULL,
[ELEDFNCDA] [varchar](5) NULL,
[ELERFLDA] [varchar](1) NULL,
[ELEDFNCDB] [varchar](5) NULL,
[ELERFLDB] [varchar](1) NULL,
[ELEDFNCDC] [varchar](5) NULL,
[ELERFLDC] [varchar](1) NULL,
[ELEDFNCDD] [varchar](5) NULL,
[ELERFLDD] [varchar](1) NULL,
[ELEDFNCDE] [varchar](5) NULL,
[ELERFLDE] [varchar](1) NULL,
[ELEDFNCDF] [varchar](5) NULL,
[ELERFLDF] [varchar](1) NULL,
[ELEDFNCDG] [varchar](5) NULL,
[ELERFLDG] [varchar](1) NULL,
[ELEDFNCDH] [varchar](5) NULL,
[ELERFLDH] [varchar](1) NULL,
[ELEDFNCDI] [varchar](5) NULL,
[ELERFLDI] [varchar](1) NULL,
[ELEDFNCDJ] [varchar](5) NULL,
[ELERFLDJ] [varchar](1) NULL,
[ELEDFNCDK] [varchar](5) NULL,
[ELERFLDK] [varchar](1) NULL,
[ELEDFNCDL] [varchar](5) NULL,
[ELERFLDL] [varchar](1) NULL,
[ELEDFNCDM] [varchar](5) NULL,
[ELERFLDM] [varchar](1) NULL,
[ELEDFNCDN] [varchar](5) NULL,
[ELERFLDN] [varchar](1) NULL,
[ELEDFNCDO] [varchar](5) NULL,
[ELERFLDO] [varchar](1) NULL,
[ELEDFNCDP] [varchar](5) NULL,
[ELERFLDP] [varchar](1) NULL,
[ELEDFNCDQ] [varchar](5) NULL,
[ELERFLDQ] [varchar](1) NULL,
[ELEDFNCDR] [varchar](5) NULL,
[ELERFLDR] [varchar](1) NULL,
[ELEDFNCDS] [varchar](5) NULL,
[ELERFLDS] [varchar](1) NULL,
[ELEDFNCDT] [varchar](5) NULL,
[ELERFLDT] [varchar](1) NULL,
[ELEIUPDTY] [int] NULL,
[ELEIUPDTM] [int] NULL,
[ELEIUPDTD] [int] NULL,
[ELESCLTR] [varchar](1) NULL,
[ELEDTCOY] [int] NULL,
[ELEDTCOM] [int] NULL,
[ELEDTCOD] [int] NULL,
[ELDTORDY] [int] NULL,
[ELDTORDM] [int] NULL,
[ELDTORDD] [int] NULL,
[ELDTRPRY] [int] NULL,
[ELDTRPRM] [int] NULL,
[ELDTRPRD] [int] NULL,
[ELERPRCD] [varchar](1) NULL,
[ELSTRHH] [int] NULL,
[ELSTRMM] [int] NULL,
[ELSTRSS] [int] NULL,
[ELSTPHH] [int] NULL,
[ELSTPMM] [int] NULL,
[ELSTPSS] [int] NULL,
[ELDTCLRYY] [int] NULL,
[ELDTCLRMM] [int] NULL,
[ELDTCLRDD] [int] NULL,
[ELIUSER] [varchar](10) NULL,
[ELIKEYID] [varchar](1) NULL,
[T_AS400_ELVPINS00_ID] [int] IDENTITY(1,1) NOT NULL,
[DOC_LINK_ID] [int] NULL,
[CRTD_BY] [varchar](30) NOT NULL,
[CRTD_DT] [datetime] NOT NULL,
[MODFD_BY] [varchar](30) NULL,
[MODFD_DT] [datetime] NULL,
[INVID] [int] NULL,
[PARENT_INSPTN_ID] [int] NULL,
[ELEEQP_ID] [int] NULL,
[COMMENTS] [varchar](1500) NULL,
[ELFEECO_ID] [int] NULL,
[T_AS400_ELVPAPP0_ID] [int] NULL,
CONSTRAINT [PK_T_AS400_ELVPINS00] PRIMARY KEY CLUSTERED
(
[T_AS400_ELVPINS00_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
Where you have functions inline with your select:
BOISdbo.UDF_PARSE_DATE_FIELDS(NULL,ELEYCEXP,ELEMCEXP,99)
Replace those function calls with the actual code that is in the function....it will be far from pretty, but should perform better.