Questions tagged [database]

Drupal provides a standard, vendor-agnostic abstraction layer for accessing database servers.

Filter by
Sorted by
Tagged with
2 votes
0 answers
214 views

How to add having to entity query Drupal\Core\Entity\Query\Sql\Query

I need to alter the query in getEntityIds method in PathAliasListBuilder i need only to get only paths with multiple path system: The sql select should be like: SELECT * FROM `path_alias` GROUP BY `...
berramou's user avatar
  • 7,175
0 votes
2 answers
3k views

"Drupal already installed" Message on Restored site

We had an issue on a Drupal 8.8.2 site, had to restore DB, Core and Vendor, now anyone visiting the site gets the site as normal, but if admin logs in I receive: Drupal 8.8.2 Drupal already installed ...
entropy1980's user avatar
0 votes
1 answer
71 views

PHP query in a view will cause website error

I'm using a global PHP query in a View to find out the count of membership users. The first query, that extracts the total number of users from the database works fine, but when I use the WHERE clause ...
Reflex Roland's user avatar
2 votes
1 answer
10k views

PDOException: SQLSTATE[HY000] [2002] No such file or directory in lock_may_be_available() (line 167

I have Drupal 7.2 application site and have upgraded from php 5.6 to php 7.2 since it reached its eol, also upgraded to rhel 8 from rhel 6.5, but while connecting to rds I am getting following error, ...
kk123's user avatar
  • 29
1 vote
0 answers
266 views

Excessive updates to cache_container table

I am maintaining a large drupal instance (10 nodes). Recently I am facing an issue. The website was up and running. But the database was overloaded, MySQL binary logs kept growing abnormally, ...
Anish Sheela's user avatar
0 votes
0 answers
84 views

Add database connections on the fly, instead of defining them in settings.php

I am trying to add DB Information on the fly, instead of defining in settings.php I am adding connection on module install $other_database = array( 'database' => 'pantheon', 'username' =>...
visabhishek's user avatar
  • 1,346
0 votes
1 answer
51 views

Deployment of full database dump still causes error

I want to deploy my local DB to a staging server. The local DB dump was exported with all tables. Including the "cache_" prefix table structures with no data exported. After deployed to staging (...
sunfffd's user avatar
  • 13
0 votes
1 answer
465 views

Get field content of all instances of a field

I'm trying to get the content of all instances of certain fields based on their names. I've got a list of fields (which are in nodes/paragraphs and blocks) of which I want to extract the values from. ...
tail-my-error's user avatar
2 votes
1 answer
313 views

Emoji works in a site but not in the other site on the same host

I am trying to enable emojis following Multi-byte UTF-8 support in Drupal 7. I have added the following to the settings.php file. 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_general_ci'...
Tasha Jordan's user avatar
2 votes
0 answers
188 views

database update warning but no updates - google tag module issue?

I'm on Drupal 8.8.2, and we've got a "database out of date" alert, requiring us to do database updates. When I attempt to do so at update.php, I get a message saying "no pending updates" I re-ran ...
turpentyne's user avatar
-2 votes
1 answer
41 views

How to query a custom content entity with fields added with UI?

In a custom module (assoc), I have a custom Content Entity (Person) with some fields: $fields['lastname'] = BaseFieldDefinition::create('string') $fields['firstname'] = BaseFieldDefinition::create('...
gbmapo's user avatar
  • 1,066
1 vote
0 answers
420 views

Database migration from Postgres to Mysql

We have a website in Drupal 7 running on Postgres database. We are planning to upgrade to Drupal 8 very soon, but we want to first migrate the database from Postgres to Mysql. I was just wondering ...
gr8's user avatar
  • 35
0 votes
1 answer
469 views

\Drupal::database()->select with Expression used as Condition

I am trying to execute this query: 'SELECT sd.entity_id AS entity_id, WEEK(node__field_start_date.field_start_date_value) AS week, YEAR(node__field_start_date.field_start_date_value) AS year FROM {...
Lia's user avatar
  • 131
0 votes
0 answers
36 views

MAMP losing one of my tables

I am using MAMP to host a Drupal-7 database on Mac OS 10.12 (Sierra). It works just fine until the first time I sign out and shut down my computer. When I come back, and try to "add content", I am ...
ksmithcamp's user avatar
1 vote
1 answer
1k views

Can't connect to remote DigitalOcean database

I am attempting to connect an existing Drupal 8 site to a DigitalOcean managed Database. The connection info I've received from DigitalOcean: username = digitaloceanadmin password = password host = ...
ymdahi's user avatar
  • 620
0 votes
1 answer
319 views

Using taxonomy exposed filter in a view ends in MySQL can only use 61 tables in a join

Scenario One hierarchical vocabulary called Countries with 300 taxonomy terms, one for each country, indenting like: America (level 1) Anguila (level 2) Antigua y barbuda (level 2) ... (level 2) ...
devcatalarubio's user avatar
0 votes
0 answers
34 views

Drupal Site Migration from FreeBSD 12 to Ubuntu 18.04 SQL database unknown behavior

I am currently trying to migrate the Drupal Site from FreeBSD 12 to Ubuntu 18.04. All the configurations are copied and moved to Ubuntu 18.04. Everything seems fine and I was able to create the Drupal ...
Jake0322's user avatar
-1 votes
2 answers
347 views

Connection issues

New to Drupal 8 and tripped up on this one. It seems something wrong with database but if anyone has tips please let me know! Here is my code: and here is error: And my drupal site isn't working at ...
Joe Spinelli's user avatar
1 vote
1 answer
145 views

I cannot delete Devel generated content because I get an error about a not existing table

I'm trying to delete some generated content but I get an unhandled exception in the log. Drupal\Core\Entity\EntityStorageException: SQLSTATE[42S02]: Base table or view not found: 1146 Table '...
esQmo_'s user avatar
  • 107
2 votes
1 answer
797 views

How do I compare fields in a database query?

Given the query fragment: $query = $connection->select('mytable', 't'); $query->addField('t', 'myfield1', 'myfield1'); $query->addField('t', 'myfield2', 'myfield2'); I need to add a ...
Delford Chaffin's user avatar
0 votes
1 answer
28 views

How to query for a list of tables in a secondary database

I'm working on some Functional tests on a secondary database. Part of the tear down process is to drop tables in the secondary database. How do a make a query like 'show tables' where I can iterate ...
jackrabbithanna's user avatar
1 vote
2 answers
392 views

PostgreSQL unbuffered query

I am producing large query results that can exceed a sizable PHP memory limit (128 Mb). I've been trying to address this and came across unbuffered queries. Unfortunately, these only seem to be ...
Ghoti's user avatar
  • 123
-1 votes
1 answer
34 views

How to Update db field value in hook_menu()?

I'm using Drupal 7, my requirement is to automatically update the node field value in a content type for a condition. I have used Hook_menu() for to get a link and if i use that link my code will ...
Naruto19's user avatar
0 votes
2 answers
728 views

How to solve “Query failed” error in drush sql-sync output 2?

I have the exact same problem as in How to solve "Query failed" error in drush sql-sync output?, exact same output. That user found the answer as the password in settings.php was wrong, but ...
user12869's user avatar
0 votes
1 answer
121 views

db_select with groupBy(CAST(column as DATE))

I am looking to achieve GROUP BY CAST(date_time AS DATE) in a db_select function in Drupal 7 but with no idea how. The function up until now is: foreach ($distinct_users as $user){ $day_record =...
Lia's user avatar
  • 131
0 votes
1 answer
155 views

Can I use the Migrate module to sync a site database with a Filemaker Pro database?

Is it possible to get data from a Filemaker Pro database and insert it into the database for a Drupal site? Ideally, I'd like to set this up so that Drupal would periodically check the Filemaker ...
Samuel's user avatar
  • 9
0 votes
1 answer
387 views

How to create a user with custom fields?

On my drupal site, using the User module, I have added extra fields to the user registration form such as 'Organization'. I notice that this has created a mysql database called '...
Oceanescence's user avatar
0 votes
0 answers
457 views

There was a problem creating field: SQLSTATE[HY000]: General error: 1364 Field 'id' doesn't have a default value

I've recently downloaded a Drupal website to work on a local host (xampp). After importing the database, changing the base_url and running the update.php script, I managed to make it work. However, ...
DamianFox's user avatar
  • 113
5 votes
3 answers
8k views

EntityQuery for taxonomy term of specific bundle

I would like to build a query for all taxonomy terms of a specific bundle. $terms = \Drupal::entityQuery('taxonomy_term') ->condition('type','mail_template') ->execute(); This returns an ...
Yaron's user avatar
  • 263
0 votes
1 answer
640 views

How to find a field name/column name of a field in database where I have only the label of that field?

I am working on an integration part with drupal framework. Here it's hard to find the table names of the field which is present in the view as I know only the field label name. Is there any way to ...
Naveen's user avatar
  • 101
1 vote
1 answer
31 views

Database API and Security

I'm working on a controller that queries a table based on the value in a route parameter Example route path: path: '/path/{parameter}' Controller: public function myFunction($parameter) { $...
Vecta's user avatar
  • 603
0 votes
0 answers
79 views

how to convert a timestamp into a date format in a custom module [duplicate]

I created a custom module and printed this outcome in .csv. Name,Event,Email,Timestamp Ea Iustum Jus,Fifa,[email protected],1573924224 How do I convert the timestamp in a date format? I tried with $...
Joehoe's user avatar
  • 336
1 vote
2 answers
2k views

Where is the node created timestamp stored in the database?

I need to create an SQL query that finds all nodes of a certain type created X days ago, so I can get their IDs. Due to the massive number of nodes in the database, I would prefer to use a direct SQL ...
Casso's user avatar
  • 15
0 votes
1 answer
211 views

Database Abstraction to Fetch published content of specific content type throwing error

I'm attempting to grab all published content of type 'homepage_slide', as currently my slider loads all content unpublished or otherwise. Here is my current Abstraction query. if ($variables['...
Rob Hern's user avatar
0 votes
0 answers
91 views

Querying entities taking an insane amount of time

Is the entity system in D7 not very well optimized? I am trying to iterate through 1500 entities using EntityFieldQuery(), and I had to extend my execution time to 300 seconds in order for the ...
Ex0r's user avatar
  • 181
1 vote
1 answer
599 views

Fetch value from JSON

I have a field in drupal "field_xyz". it stores json values. JSON looks like this: {"Id_-_SiteWasteProductAction":"34638393224", "Postcode": "CSF 12CF"} I want to fetch postcode value from this json ...
KUSHAL AGRAWAL's user avatar
2 votes
1 answer
1k views

What is error: "Base table or view not found: 1146"

Base table or view not found: 1146 Table '(database).(entity)__(field_name)' doesn't exist I have problems running my site since i deleted field (field_name) from entity (entity), to be clear entity ...
XYZT's user avatar
  • 23
0 votes
0 answers
371 views

How to get only published revisions of a node?

I have several types of content that are moderated(content_moderation and workflows), in a custom validation process I need to know if a particular node has at least one published revision. Is there a ...
chalo's user avatar
  • 431
-2 votes
1 answer
126 views

Installing a module on a separate database

I currently have a Drupal 7 site with a big database. I have to install the Drupal Commerce module and I would like to install the module using a separate database. I know I have to setup the second ...
Carlos Solé's user avatar
0 votes
0 answers
416 views

Notice: unserialize(): Error at offset XX (removing Paragraphs)

I'm trying to remove Paragraphs and modules related to it manually (because I can't remove it completly from admin page). I'm using UTF8 without BOM in Notepad++ when editing key_value BLOB file that ...
renguer0's user avatar
1 vote
1 answer
2k views

Drush cannot connect to the database when updating

I am trying to update Drupal from version 8.7.5 to 8.7.7. I installed Drupal using composer and had a really old version of Drush that I had installed from apt-get. I uninstalled the old version and ...
SomeoneElse's user avatar
1 vote
0 answers
37 views

How to create a query nodes, that queries content with more than one comment?

Consider this example: $query = \Drupal::entityTypeManager()->getStorage('node')->getQuery(); $nids = $query->condition('type', 'question') ->condition('status', 1) ->...
ilovedrupal93's user avatar
0 votes
0 answers
16 views

Items removed from Node Reference field are still displaying on the node

This problem only very recently cropped up; I've never encountered it before. I have a content type (Resource) that contains a Node Reference field (pointing to Organization nodes) that allows ...
Brandon's user avatar
  • 11
1 vote
1 answer
64 views

Delete user in transaction

I'm having trouble figuring out why the following code isn't working in Drupal 7. _queue_processor is a cron queue processor function: function _queue_processor($uid) { $transaction = ...
mbomb007's user avatar
  • 514
0 votes
0 answers
362 views

How to add a UNION to a query in hook_views_query_alter?

I have a custom multiple-value field (via plugin) in a bundle that needs to have an dynamic entry added prior to rendering in the view. I've tried render hooks. The problem is that if there are ...
JAyenGreen's user avatar
-1 votes
1 answer
202 views

How can I run a Views SQL query in PhpMyAdmin?

i go to admin/structure/views/settings, check Show information and statistics about the view during live preview and then Show the SQL query checkbox that will appear below. I have a field which is ...
tajovake's user avatar
0 votes
1 answer
1k views

How to save the webform data to custom table?

I designed a student registration form using webforms module. My requirement is to save data from the form to table student. How can i achieve this? Is there anyway to mention this in configuration ...
Dinesh Reddy Kancharla's user avatar
1 vote
1 answer
313 views

Can I get integers from a dynamic query using fetchAllKeyed?

So basically I want an array of integers from a query using fetchAllKeyed for the results. The field is an tinyint in the db so I would expect an indexed array of integers but I am getting an ...
mcoatney's user avatar
  • 105
1 vote
1 answer
2k views

Fetching node field values programmatically

I have figured out how to query the node table programmatically without using the deprecated db_query() function. However, I soon discovered that the actual content fields are not held in the node ...
Neil Hillman's user avatar
0 votes
1 answer
112 views

Entity wrapper save using db_transaction()?

I am using a db_transaction() for some data updates. I am using some EntityMetadataWrappers, modify some data, then save. The thing is, the wrapper ->save() function doesn't have a parameter for $...
mbomb007's user avatar
  • 514

1 2 3
4
5
63