rom-sql | SQL support for rom-rb | SQL Database library
kandi X-RAY | rom-sql Summary
kandi X-RAY | rom-sql Summary
SQL support for rom-rb
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of rom-sql
rom-sql Key Features
rom-sql Examples and Code Snippets
Community Discussions
Trending Discussions on rom-sql
QUESTION
This is a followup to this question:
Ruby create JSON from SQL Server
I was able to create nested arrays in JSON. But I'm struggling with looping through records and appending a file with each record. Also how would I add a root element just at the top of the json and not on each record. "aaSequences" needs to be at the top just once... I also need a comma between each record.
here is my code so far
...ANSWER
Answered 2022-Mar-30 at 12:35You can just do the whole thing in SQL using FOR JSON
.
Unfortunately, arrays are not possible using this method. There are anumber of hacks, but the easiest one in your situation is to just append to []
using JSON_MODIFY
QUESTION
I am trying to execute an SSIS package using a Credential and Proxy - it works fine with a user with a SysAdmin role and we want to avoid using SysAdmin.
I have followed all the steps to create a Credential and Proxy and set up the permissions for the user in msdb and SSISDb tables and in the Security -> logins
I have followed the steps in the below links as a guide:-
- Run an SSIS Package Under a Different Account
- Running a SSIS Package from SQL Server Agent Using a Proxy Account
- SQL Server Agent - Running SSIS Package with Proxy
Proxy -> properties -> Principals
When I run the job I get the below error - looks like a permission issue
Unable to start execution of step 1 (Reason: Could not get proxy data for proxy_id = 198_. The step failed.
What am I missing?
...ANSWER
Answered 2022-Feb-21 at 19:37As you mentioned in the comments, you are using an SQL Server login as a proxy account. While in the Microsoft documentation they mentioned that:
SQL Server Agent proxies use credentials to store information about Windows user accounts. The user-specified in the credential must have "Access this computer from the network" permission (SeNetworkLogonRight) on the computer on which SQL Server is running.
I suggest following one of the following articles to set up an SQL Server agent proxy:
QUESTION
I have a Dataset
gathering informations about French cities,
ANSWER
Answered 2022-Jan-18 at 12:36I found out the answer. The problem isn't the parquet file itself, but the fact that these statements:
QUESTION
I used this guide to build an ASP.NET Web Form in VS 2019 with a button that executes a stored procedure on my SQL server, and writes the results to a CSV file for download through the browser.
It all works great, except that it's incredibly slow.
For example, it took over an hour for it to generate a 3.4 MB CSV with 20K rows.
Is there any way to speed this up at all?
Here's my code because I did modify it slightly from what I could find searching for this issue, but none of it helped, unfortunately:
...ANSWER
Answered 2022-Jan-04 at 22:30Ok, there is a simple explain for why this runs so slow. And in fact, you can make this run SEVERAL MILLION times faster!
First up: Database and indexing? Not a problem with 20,000 rows. In fact, if you use some old computer you found in a dumpster? It will easy pull 100,000 rows per second - and do so against a database WITHOUT ANY indexing!! - even if you apply sorting and criteria.
So, no, this is not a database issue - you have HUGE speed, and you would in fact require some efforts to make the database run slow.
so, then what is the problem?
Why of course it is the string concatenation !!!!
Think of it this way:
Say you have to walk 150 miles
But, say when you reach 100 miles? To go to the 101st mile?
Well, you go back to mile 1, and then walk 100 miles + 1 mile.
Then for mile 102?
You go back to mile 1, and then walk 102 miles
Then for mile 103?
You go back to mile 1, and then walk 103 miles
Note how for just 100 to 103, you now walked OVER 300 miles!!!
The SAME is occurring for your string concatenation. In fact, after your string reaches about 2000 or so characters, you going to see HUGE slowdowns.
So, assume your string has now 500,000 characters?
And you go
QUESTION
I have lately stumbled upon a blog post that talks about a stored procedure called Recover_Deleted_Data_Proc.sql
that can apparently recover your deleted data from the .log
file.
There is nothing new under the sun, we are going to use fn_dblog
.
STEPS TO REPRODUCE
We are first going to create the table:
...ANSWER
Answered 2021-Nov-15 at 22:43The code is 10 years old and was written with the assumption that a [PAGE ID]
would only ever be expressed as a pair of integers, e.g. 0001:00000138
- however, as you have learned, sometimes that is expressed differently, like 0x41-->01 ; 0001:00000138
.
You can fix that problem by adding this inside the cursor:
QUESTION
I am new to PostgreSQL and as a company, we have found out that PostgreSQL is better than SQL Server on processing online transactions and we have reached a conclusion to migrate from SQL Server to PostgreSQL.
I have bought DBConvert to successfully migrate the database from MS SQL Server to PostgreSQL and that is just fine, all data has been transferred. Now, the problem comes when I now have to move my visual studio from EF to PostgreSQL. I have researched how best I could really do this. This Article is not detailed enough:
Migrate EF6 database-first from SQL Server to PostgreSQL
An several aren't detailed enough. Can anyone assist me in a step-by-step approach on how best I could do this?
...ANSWER
Answered 2021-Sep-23 at 12:37Well, I finally found that the only way to successfully move from Visual Studio Entity Framework to PostgreSQL, you have to use the Code First Approach.
There is no scaffolding solution I found to do the conversion. You will have to install the Npgsql Provider, change the connection string to point to PostgreSQL, and also install the Npgsql.EntityFramwework and make sure your models have been changed accordingly.
QUESTION
I have a requirement where I need to get the immediate result of an update statement. I saw that I can do that by using the SQL data-change-statement modifiers. However, I'm not being able to get the final result after applying all associated triggers. For example, let's say I have the following query:
...ANSWER
Answered 2021-Jul-28 at 15:48Use BEFORE UPDATE
trigger and either NEW TABLE
(in any case) or FINAL TABLE
(if you don't have AFTER UPDATE
triggers).
If you can't use BEFORE
trigger to implement your update logic, then you can't use a data-change-statement to achieve your goal.
QUESTION
I'm trying to move some data from Azure SQL Server Database to Azure Blob Storage with the "Copy Data" pipeline in Azure Data Factory. In particular, I'm using the "Use query" option with the ?AdfDynamicRangePartitionCondition
hook, as suggested by Microsoft's pattern here, in the Source
tab of the pipeline, and the copy operation is parallelized by the presence of a partition key used in the query itself.
The source on SQL Server Database consists of two views with ~300k and ~3M rows, respectively. Additionally, the views have the same query structure, e.g. (pseudo-code)
...ANSWER
Answered 2021-Jun-10 at 06:24When there's a copy activity performance issue in ADF and the root cause is not obvious (e.g. if source is fast, but sink is throttled, and we know why) -- here's how I would go about it :
- Start with the Integration Runtime (IR) (doc.). This might be a jobs' concurrency issue, a network throughput issue, or just an undersized VM (in case of self-hosted). Like, >80% of all issues in my prod ETL are caused by IR-s, in one way or another.
- Replicate copy activity behavior both on source & sink. Query the views from your local machine (ideally, from a VM in the same environment as your IR), write the flat files to blob, etc. I'm assuming you've done that already, but having another observation rarely hurts.
- Test various configurations of copy activity. Changing
isolationLevel
,partitionOption
,parallelCopies
andenableStaging
would be my first steps here. This won't fix the root cause of your issue, obviously, but can point a direction for you to dig in further. - Try searching the documentation (this doc., provided by @Leon is a good start). This should have been a step #1, however, I find ADF documentation somewhat lacking.
N.B. this is based on my personal experience with Data Factory.
Providing a specific solution in this case is, indeed, quite hard.
QUESTION
I'm looking at the Db2 LUW feature "returning result sets from SQL", which seems to work in a similar fashion to what's possible in MySQL, SQL Server by running a simple SELECT
from any procedural logic, or in Oracle by using DBMS_SQL.RETURN_RESULT
. The following anonymous block seems to be valid:
ANSWER
Answered 2021-Jun-02 at 14:36You can't return result sets if not from a procedure
See docs
WITH RETURN Specifies that the result table of the cursor is intended to be used as a result set that will be returned from a procedure. WITH RETURN is relevant only if the DECLARE CURSOR statement is contained with the source code for a procedure. In other cases, the precompiler might accept the clause, but it has no effect.
I understand that it may just be an example, but procedural statements are not needed to return integers from 1 to 10, the following query also does :
QUESTION
I am making an app in which users can fill a form and can save their financial transaction details for every transaction they make, for this, I want to add a date as well and also I want to fetch data using the date as well. I am creating my database as follows:
...ANSWER
Answered 2021-Apr-20 at 16:38That is the correct way which I was using everything was correct, turns out the problem was with adding single quotes in dates that's why it was not working. Now everything is working.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install rom-sql
On a UNIX-like operating system, using your system’s package manager is easiest. However, the packaged Ruby version may not be the newest one. There is also an installer for Windows. Managers help you to switch between multiple Ruby versions on your system. Installers can be used to install a specific or multiple Ruby versions. Please refer ruby-lang.org for more information.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page