driver to connect to mysql with python [closed] - python

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
i am trying to connect to a database and insert data with python.I found too many connector drivers like : mysql-connector,pymysql, MySQLdb. I want to know which way is better to communicate with database in python3.4 .

In our project we have remote machine with MySQL default client, we create SSH object of it and run sql query using traditional client. It's the most safe way and supports mostly everything with best optimized support.
However, if you want to prepare sql handle in python I will suggest go for pymysql, as pymysql is updated regularly & its very much stable & easy to use compared to others.

I would check out sqlalchemy http://www.sqlalchemy.org/. Or if you want more of an object-relational-manager then set up a small Django project https://www.djangoproject.com/.

Related

Executing MSSQL File from Python 3.9 [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 10 months ago.
Improve this question
I have a large SQL script which is too large to run from SQL Server Management Studio.
Is there a way to run such a script using Python?
SQLite3 doesn't seem to work. I keep getting syntax errors but the query is standard SQL.
Is there an MSSQL equivalent library in Python?
Use cursor from a pyodbc connection.
cursor.execute(<sql code as string>)
cursor.commit()
If you use sqlalchemy, you can get the cursor from engine as follows:
engine.raw_connection().cursor()

Building python app and connecting to remote database [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I want to write a python app that will contain a connection to remote DB.
The user will be able to log in with a username and password (also from different computers) and get his own information in the app. Therefore I would like the information to be saved on a remote server. Which server I can use for this purpose? Preferably free.
You can use something like heroku for your hosting. Depending on the database you can probably find a good plugin.
Here are some docs if needed:
https://devcenter.heroku.com/categories/reference
what you're asking is how to build an application/website, you need to have programming knowledge to do that. to store your information you can use one of many databases available like "MySQL", "Postgres", "MariaDB", "MangoDB" and many others.
i recommend you to use MariaDB as it's the free equivalent of MySQL.

Switch to Graylog from Mariadb? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
TL DR: should you use graylog instead mariadb as database for a moderate amount of data? Would this be a good idea?
Longversion:
There is a python script which puts some nmap monitoring data (maybe 1000 to 10000 rows) into a maria database each day. It is using sql alchemy, a flask website is using the same datatypes to display the results and everything is working fine. The model is not too complicated, 3 Tables with a one to many relation.
ip range -> hosts -> ports (with results)
Now my boss wants to put everything into graylog with a python binding and to abadon sql alchemy and the mariadb completly.
My question is: would you recommend to keep the existing structure and just export each night everything from the mariadb into the graylog server (the data is collected just once a night).
Replace the database / mysql alchemy and use Graylog directly? I have never worked with Graylog and I am not sure if you can use it as a database replacement.
Graylog is a log agregator like Splunk its not a relational database itself. From what you describe you are using the MariaDB Database like a logging utility for this data.
Questions to ask yourself are, do you have other logs you should be aggregating and collecting or is it just this one niche set of data?
If you have multiple sources then Graylog is one answer but if its just this subset then its probably overkill.
For context I use Splunk to aggregate over 50GB of logs per day, they come from servers, networking gear, firewalls and more. I'd never think to pour that data into a SQL Database, its not the right tool for the job.

Load data from Essbase into SQL database [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm currently using a mix of smart view and power query(sql) to load data into Excel models however my excel always crashes when smart view is used. I'm required to work in Excel but I'm know looking at finding a way to periodically load data from Essbase into my SQL server database and only use power query(sql) for all my models. What would be my best options in doing this? Being a Python enthusiast I found essbasepy.py however there isn't much documentation on it. Please help
There are a couple of ways to go. The most straightforward is to export all of the data from your Essbase database using column export, then designing a process to load the data into SQL Server (such as using the import functionality or BULK IMPORT, or SSIS...).
Another approach is to use the DataExport calc script command to export either to a file (that you then load into SQL) or directly to the relational database (DataExport can be configured to export data directly to relational).
In either case, you will need privileges that are greater than normal user privileges, and either approach involves Essbase automation that may require you to coordinate with the Essbase admin.

Matlab integration with Ruby on Rails [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to create Ruby on Rails web app (or on other dynamic languages such as Python), that should interact with Matlab.
Web app sends some info to the matlab server (or simply run matlab file with necessary data if it's possible) that processing this stuff and returns results back to the Rails server. Is it possible to do something like this?
If I understand correctly, you want to want to send info to matlab from a webapp. Then run some process on it using matlab, then it sends the info back to ruby to display it.
No matlab expert but if you did it in python (which you said you could) you could write your results to a database and then read the database in ruby, I expect you can export results from matlab into a database as well.
To use SQLite database in python you can import the module:
import sqlite3
The relevant documentation is here https://docs.python.org/2/library/sqlite3.html

Categories