How to retrieve information after specific strings in my sql - mysql

I am making csv file by sql2excell component for joomla. It calls the data by SQL queries, so I retrieve all the information through SQL queries. The problem is some that fields have extra information which I don't want to display to the end user.
For example, the fields show the data below when I retrieve by a query:
a:3:{s:4:"city";s:3:"000";s:3:"ext";s:3:"000";s:3:"tel";s:4:"0000";}
I only want the values that are in quotes, like this: 0000000000
Is there any way I can get this by an SQL query?

No.
These values are serialized and MySQL doesn't have functions to deserialize them. You have to make a bridge between MySQL and sql2excel which would decode it, but Im not familiar with this tool so can't be of much help.

Related

Is it possible to use sqlalchemy to reflect table and change data type of column from string to datetime?

I have a web application where users can upload CSVs. I use Python Pandas to actually do the upload. I have to give the users the ability to change the database table's column's types such as from strings to datetimes. Is there a way to do this in Sqlalchemy? I'm working with reflected tables, and so I have Table objects with all their columns but I have a feeling that Sqlalchemy does not have this capability and that I will have to execute raw SQL to do this.

Turning Raw data into TypeORM Entity

I have data that I am sending to my NodeJs server that is in the standard SQL format with the default SQL column names etc.
I want to take these raw entities and reinsert them into the db. It seems like I can't insert them straight up without converting them into entities, or preparing a raw SQL statement.
I want to turn these values into TypeORM entities automatically without having to write transform functions.
Is there a good way to accomplish this in TypeORM?

Convert text box values in access query to mysql

I am currently in the process of moving all my Access databases to a MySQL server. I have some pretty big queries I would like to convert into sql direct.
The only thing is that in those queries I am using the content of a textbox in my form :
IIf(IsNull([Formulaires]![DialogueMAJDossier]![FiltreTypeEntree]),[TypeDossier],[Formulaires]![DialogueMAJDossier]![FiltreTypeEntree])
(Excuse me for all the names being in french)
I know that when I convert it to MySQL syntax, it should give something like this :
IFNULL(`Formulaires`.`DialogueMAJDossier`.`FiltreTypeEntree`, `TypeDossier`)
But I have no idea how to account for the text box value in my query.
Any help will be gladly appreciated
Pass-Through queries cannot have parameters, so you'll have to use a workaround.
Option 1:
Save the SQL with "variables" in a template table, e.g. SELECT foo, {FiltreTypeEntree} FROM bar.
Then before executing the Pass-Through query, read the template SQL, Replace() the variable with the result of your IIf expression, and set the .SQL property of the query with the final string.
Option 2:
Create a "Variables" table in MySql. Fill its fields via code, and have your Pass-Through query join this table to get the variable values.
In a multi-user scenario, you'd have to introduce some kind of session management for Option 2, so I'd go with (1) in this case.

Can data from a sql query be inserted into elasticsearch?

I'm new to elasticsearch.I have learnt how to give different queries and get search results with the understanding that each document is stored in json format.Is it possible to insert records that were obtained from an sql query on a relational database?If it is possible,how is it done? by converting each record into json format?
You need to build an index in elasticsearch similar to the way you've got your tables in the RMDBS, this can be done in a lot of ways and it really depends on what data you would need to access via elasticsearch. You shouldnt just dump your complete RMDBS data into ES.
If you search around you may find bulk data importers/synchronisers/rivers(deprecated) for your RMDBS to ES, some of these can run in the background and keep the indexes in ES upto date with your RMDBS.
You can create your own code as well which updates ES whenever any data is changed in your RMDBS. Look into the API for your platform Elastic Search Client APIhttps://www.elastic.co/guide/en/elasticsearch/client/index.html

Finding specific value in MySQL database

This may sound strange but is it possible to construct a SQL statement that search all the tables in a database for a specific value? I'm testing another person's Drupal(V.7) code and that code uses taxonomy_term_save function to import data in CSV format. I like to find the table where these data are stored. I don't know the field name either. Is it possible? I use MySQL.
SELECT * FROM databasenameHERE WHERE tablenameHERE = 'keyYouAreSearchingForHere'";
That is for MySql