I have the following query which requires SET SQL_BIG_SELECTS = 1; to be run before it.
SET SQL_BIG_SELECTS = 1;
SELECT uc_products.nid, uc_products.model, uc_products.sell_price
FROM uc_products, node
WHERE node.status = 1
GROUP BY nid
This generates exactly what I need in phpMyAdmin. I need to export this as a CSV file but when I go to export, it loses the SET SQL_BIG_SELECTS = 1; part of the query and there's no way to add it back in. This means that in the CSV file, I'm getting an error message telling me to use SET SQL_BIG_SELECTS = 1; in order to run the query properly.
Has anyone come across this problem before or have any idea how to get around it?
You can set SQL_BIG_SELECTS in config file or at server startup. It can also be set on a session basis with 'SET SESSION SQL_BIG_SELECTS=1'.
Related
I'm trying to setup the basic suite of spidermon monitors as described here I did a quick Google search and also found this. So I made a quick monitors.py, then copy and pasted the code in there.
I then proceeded to do this:
SPIDERMON_ENABLED = True
SPIDERMON_SPIDER_CLOSE_MONITORS = (
'spidermon.contrib.scrapy.monitors.SpiderCloseMonitorSuite',
)
in my settings.py in the scrapy project.
It keeps raising this error:
spidermon.exceptions.NotConfigured: You should specify a minimum number of items to check against
Which I believe I've done (SPIDERMON_MIN_ITEMS = 10 # "SPIDERMON_MIN_ITEMS" - at the top of the file).
What am I doing wrong? I just want to setup the pre-defined monitors and then optimize them later.
Spidermon couldn't find a valid value for SPIDERMON_MIN_ITEMS in the settings. This must be an integer value bigger than zero otherwise it'll throw the error described. SPIDERMON_ADD_FIELD_COVERAGE set is also mandatory in order to use all the monitors available in this MonitorSuite.
In order to run the built-in close MonitorSuite SpiderCloseMonitorSuite from Spidermon project, please confirm if the settings.py file - located in the root directory of your scrapy project - have the variables below:
EXTENSIONS = {
'spidermon.contrib.scrapy.extensions.Spidermon': 500,
}
SPIDERMON_ENABLED = True
SPIDERMON_MIN_ITEMS = 10
SPIDERMON_ADD_FIELD_COVERAGE = True
SPIDERMON_SPIDER_CLOSE_MONITORS = (
'spidermon.contrib.scrapy.monitors.SpiderCloseMonitorSuite',
)
We are trying to copy the data frame to Teradata specific database and the script is not accepting the schema_name parameter. Data Copy to User Database, which used in logon command is happening. But I tried to override the default and specifying Database Name in the copy_to_sql it is failing.
from teradataml import *
from teradataml.dataframe.copy_to import copy_to_sql
create_context(host = "ipaddrr", username='uname', password = "pwd")
df = DataFrame.from_query("select top 10* from dbc.tables;")
copy_to_sql(df = df ,table_name = 'Tab', schema_name='DB_Name',if_exists = 'replace')
Error: TeradataMlException: [Teradata][teradataml](TDML_2007) Invalid value(s) 'DB_Name' passed to argument 'schema_name', should be: A valid database/schema name..
Do you have a database / user named DB_Name? If not, try creating the database first and then running your copy script:
CREATE DATABASE DB_NAME FROM <parent_DB> AS PERMANENT = 1000000000;
I don't think the utilities / packages will typically create a database for you on the fly, since it can be a more involved operation (locks, space allocation, etc.) than creating a table.
Has anyone run into issues attempting to set hive properties through pyodbc and the properties not taking?
I'm able to connect to my Hive server and run queries that would indicate a session is remaining open (eg. using temporary tables).
However, when I try:
set hive.mapred.mode = nonstrict;
or
set hive.execution.engine = mr;
Neither of these properties get set.
Thoughts?
Try the following: set hive.hive.mapred.mode = nonstrict;
I want to set a variable $import_location so that I can set it once for many uses and not hard-code it into each test case that is doing file uploads.
I have the variable set OK with the store command.
I am trying to use it on the uploads screen but keep getting the literal ${variable name}
How can I set the import location to be the variable that I've set above?
I just hadn't run the actual 'variable setting' script. One I had run it and created the variable I was able to use it OK.
I am trying to migrate a wordpress website to a new server, which is on mediatemple.
In there migration guide, it suggests updating the site preview/paths to the IP of the server.
It gives a SQL query to run in phpMyAdmin which is:
UPDATE `dbname`.`wp_options` SET `option_value` = 'http://xxx.xxx.xxx.xxx' WHERE `wp_options`.`option_id` =1 AND `wp_options`.`blog_id` =0 AND CONVERT( `wp_options`.`option_name` USING utf8 ) = 'siteurl' LIMIT 1 ;
But can't get it to work as it reports an error when I run it.
This is the updated query inputted with my details:
UPDATE `db87924`.`db87924_rockhaq` SET `option_value` = 'http://64.207.145.39' WHERE `wp_options`.`option_id` =1 AND `db87924_rockhaq`.`blog_id` =0 AND CONVERT( `wp_options`.`option_name` USING utf8 ) = 'siteurl' LIMIT 1 ;
I'm guessing that 'option_value', 'wp_options', 'option_id' and 'option_name' need to be replaced with something but have no idea what and can't find any more info on it.
If anyone has any ideas, that would be great!
Thanks
Always backup the database in case something goes awry. :D
This is the query I would use to migrate the WP install and has worked for me so far (might be different for you):
UPDATE wp_options SET option_value='http://64.207.145.39' WHERE option_name='siteurl';
UPDATE wp_options SET option_value='http://64.207.145.39' WHERE option_name='home';
However, if your WP install hosts more than 1 blog, then I would update the query to:
UPDATE wp_options SET option_value='http://64.207.145.39' WHERE option_name='siteurl' AND blog_id=0;
UPDATE wp_options SET option_value='http://64.207.145.39' WHERE option_name='home' AND blog_id=0;
These change the paths/links in Wordpress (in my experience, both settings need to be changed: home and siteurl).
If this works, you would probably need to run the query again when the DNS is transferred.
wp-config.php might also has some hardcoded paths which need to be changed.
http://codex.wordpress.org/Editing_wp-config.php#WordPress_address_.28URL.29