sqlbucket | Lightweight library to write , orchestrate and test | Data Migration library
kandi X-RAY | sqlbucket Summary
kandi X-RAY | sqlbucket Summary
Lightweight library to write, orchestrate and test your SQL ETL. Writing ETL with data integrity in mind.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Decorator to wrap a function to send messages
- Configure the jinja environment
- Render the connection query string
- Create and return a Jinja environment
- Render the project
- Render the query
- Runs the authentication
- Runs the integrity checks
- Create a connection to the database
- Configures the jinja environment
- Log the integrity of the query
- Print the rows in the table
- Returns True if all rows are passed in
- Check if the passed field is missing
- Run a connection query
sqlbucket Key Features
sqlbucket Examples and Code Snippets
Community Discussions
Trending Discussions on Data Migration
QUESTION
I'm trying to migrate all the old databases from SQL SERVER to AZURE SQL Database using Database Migration tool and successfully able to do.
There are more than 100 databases to migrate so for each and every database running the tool and repeating the process is lot of process.
Can someone help with migrating Multiple databases in one go or doing one at a time is the only solution.
Thanks.
...ANSWER
Answered 2022-Mar-29 at 08:15You can only select a single database from your source to migrate to the Azure SQL database using the Data Migration Assistant tool.
You can create an Azure Database Migration Service resource in the Azure portal and select one or more databases to migrate from SQL Server to Azure SQL Database.
Refer this Microsoft documentation for detailed process.
QUESTION
I'm trying to load a table from Oracle to Postgres using SSIS, with ~200 million records. Oracle, Postgres, and SSIS are on separate servers.
Reading data from OracleTo read data from the Oracle database, I am using an OLE DB connection using "Oracle Provider for OLE DB". The OLE DB Source is configured to read data using an SQL Command.
In total there are 44 columns, mostly varchar, 11 numeric, and 3 timestamps.
Loading data into PostgresTo lead data into Postgres, I am using an ODBC connection. The ODBC destination component is configured to load data in batch mode (not row-by-row insertion).
SSIS configurationI created an SSIS package that only contains a straightforward Data Flow Task.
IssueThe load seems to take many hours to reach even a million count. The source query is giving results quickly while executing in SQL developer. But when I tried to export it threw limit exceeded error.
In SSIS, when I tried to preview the result of the Source SQL command it returned: The system cannot find message text for message number 0x80040e51 in the message file for OraOLEDB. (OraOLEDB)
Noting that the source(SQL command) and target table don't have any indexes.
Could you please suggest any methods to improve the load performance?
...ANSWER
Answered 2022-Feb-20 at 09:22I will try to give some tips to help you improve your package performance. You should start troubleshooting your package systematically to find the performance bottleneck.
Some provided links are related to SQL Server. No worries! The same rules are applied in all database management systems.
1. Available resourcesFirst, you should ensure that you have sufficient resources to load the data from the source server into the destination server.
Ensure that the available memory on the source, ETL, and destination servers can handle the amount of data you are trying to load. Besides, make sure that your network connection bandwidth is not decreasing the data transfer performance.
Make sure that the following hardware issues are not occurring in any of the servers:
- Drive out of storage
- Server is out of memory
Make sure that your machine is not running out of memory. You can simply use the Task Manager to identify the amount of available memory.
2. The Data Source Make sure that the table is not a heapAfter checking the available resources, you should ensure that your data source is not a heap. At least it would be best if you had a primary key created on that table.
IndexesIf your SQL Command contains any filtering, ordering, or Joins, you should create the indexes needed by those operations.
- Use WHERE, JOIN, ORDER BY, SELECT Column Order When Creating Indexes
- Is the WHERE-JOIN-ORDER-(SELECT) rule for index column order wrong?
Instead of using OLE DB source to connect to Oracle, try using the Microsoft Connector for Oracle (Previously known as Attunity connectors). Microsoft previously mentioned that it should provide faster performance than traditional OLE DB providers.
Use the Oracle connection manager rather than OLE DB connection manager.
To be honest, I am not sure if this component can make the data load faster since I didn't test it before
Removing the destination and adding a dummy taskThe last thing to try is to remove the ODBC destination and add any dummy task. For example, use a row count component.
Run the package; if the data is loaded faster, then loading data from Oracle is not decreasing the performance.
3. SSIS configurationNow, let us start troubleshooting the SSIS package.
Running in 64-bit modeFirst, try to execute the package in 64-bit mode. You can change this from the package configuration. Make sure that the Run64bitRuntime
property is set to True
.
Using SSIS, data is loaded in memory while being transferred from source to destination. There are two properties in the data flow task that specifies how much data is transferred in memory buffers used by the SSIS pipelines.
Based on the following Integration Services performance tuning white paper:
DefaultMaxBufferRows – DefaultMaxBufferRows is a configurable setting of the SSIS Data Flow task that is automatically set at 10,000 records. SSIS multiplies the Estimated Row Size by the DefaultMaxBufferRows to get a rough sense of your dataset size per 10,000 records. You should not configure this setting without understanding how it relates to DefaultMaxBufferSize.
DefaultMaxBufferSize – DefaultMaxBufferSize is another configurable setting of the SSIS Data Flow task. The DefaultMaxBufferSize is automatically set to 10 MB by default. As you configure this setting, keep in mind that its upper bound is constrained by an internal SSIS parameter called MaxBufferSize which is set to 100 MB and can not be changed.
You should try to change those values and test your package performance each time you change them until the package performance increases.
4. Destination Indexes/Triggers/ConstraintsYou should make sure that the destination table does not have any constraints or triggers since they significantly decrease the data load performance; each batch inserted should be validated or preprocessed before storing it.
- Are SQL Server database triggers evil?
- The benefits, costs, and documentation of database constraints
Besides, the more you have indexes the lower is the data load performance.
ODBC Destination custom propertiesODBC destination has several custom properties that can affect the data load performance such as BatchSize
(Rows per batch), TransactionSize
(TransactionSize is only available in the advanced editor).
QUESTION
normally I would put the code for seeding users in the OnModelCreating()
Its not an issue with one
DbContext.
identity's DbContext
from the App's DbContext
, which has added two DbContexts and some confusion.
public UseManagementDbContext(DbContextOptions options) : base(options)
// security/users separationpublic AppDbContext(DbContextOptions options) : base(options)
But when you have two separate DbContexts, How do I seed the user / role data?
IdentityDbContext
-- this has all thecontext for seeding
AppDbContext
-- this does NOT havecontext, but my Migrations use this context.
Can you please help how to seed the user and role data, and is part of the migrations or startup etc.
Update: using core 6 sample, @Zhi Lv - how do I retrofit into program.cs my seedData when the app is fired up
My Program.cs
was from created originally from the ASP Core 3.1 template, it looks like this, what should I refactor, (oddly in the link at MS, there are no class name brackets, so where does my seed get setup and invoked from?
ANSWER
Answered 2022-Jan-18 at 06:06To seed the user and role data, you can create a static class, like this:
QUESTION
I have a task where I need to get the last 125 data from an excel workbook copied to another workbook. And I want the user to select from a file browser the excel file where the data has been stored. The data will always in the the range of C17:C2051, F17:F2051 and goes on...
At last I want to put two formula above these ranges.
There are the formulas:
...ANSWER
Answered 2021-Oct-27 at 17:46This should get you started:
QUESTION
My database has a table of person, and on that table there is a column named PersonImageUrl
(which is hosted in a public container in azure). I have an upcoming migration to a new database. The new column in the new database table requires VARBINARY(max)
. I want to create a stored procedure to convert the contents of PersonImageUrl
(file where the URL points to) into a byte array so that it would meet the requirements of my migration. Is this possible?
ANSWER
Answered 2021-Oct-27 at 00:13Azure SQL Database (and SQL Server 2017+) has a built-in integration to Azure BLOB storage, and for a public container you don't even need a credential, Eg:
QUESTION
I want to copy the Data from the AzureCosmosDb Database\Container to the Local.
I am trying with the Azcopy tool. I have tried the query as per this URL. But its not working. The query which I have tried is as below :
...ANSWER
Answered 2021-Oct-06 at 09:07The above method is recommended for Table API as mentioned in the doc, if you want to migrate data of SQL API use the Data Migration Tool.
QUESTION
I hope this is ok to ask here. I have been looking through so many sites but still unable to come up with a decision.
Here's the scenario. I have a legacy application that has it's data in Sql Server database(s). A new application has now been created that also will be storing data in a Sql Server database. I need to now migrate the data from the legacy to the new application. The legacy database(s) structures have been modified in the new application to follow best practices and make it more efficient (eg: use of PK, FK, indexes, lookups, better table structures etc). So there will be a lot of transformation (lookups, data cleaning, merging/splitting data etc) happening from source to destination. Initially we will be doing only 5 years worth of data, but at a later point we may need to move the rest of the data across.
The company uses Azure for storage and there is no on-prem resources.
Given this situation, what would be the best option for Data Migration? SSIS or ADF? What are the advantages of one over the other (other than the fact that ADF is Azure cloud based and MS are probably moving to ADF more in the future). We will also need Dev/Test/Prod environments if that matters.
ANSWER
Answered 2021-Sep-28 at 11:33Considering the company doesn't have on-prem resources, I would be looking at implementing the data migration on Azure Data Factory. Below are few points to take into consideration:
Pros:
- Integration between ADF and other Azure resources e.g. SQL Database is seamless and doesn't require connector setup, etc.
- You would take advantage of Microsoft's network to improve your data transfer, your data won't go over the network, everything is within MS data centers.
- More secure and reliable transfer, you could take advantage of ADF Managed Identity for authenticating to your source and destination.
- Since there will be a lot of changes, splits, etc, you can take advantage of ADF's ability to start from where the pipelines failed. On the other hand, in SSIS you'd need to start all over again.
- Better monitoring capabilities
Cons:
- You'd need an infrastructure to develop, deploy, and run your SSIS packages, which will increase implementation time and maintenance overhead.
- You could run SSIS packages using ADF, but it requires a much bigger implementation to host your packages and run them. Also, it'd be more costly.
- If the plan is to use a VM, there is an additional overhead to set up the VM and SSIS. Also, the cost associated with spinning up a new VM and SQL Server.
- Not great monitoring and retry capabilities
QUESTION
As part of the data migration from DB2 z/OS (Mainframe) to Google cloud SQL, I don't see the direct service/connector provided by google or IBM. So, I am exploring the option to move the data to MySQL first and then to Cloud SQL.
I could see the solution to migrate from Mysql to cloud SQL but not DB2 to MYSQL.
I searched in google for this need but I could not find the resolution.
Will it be connected based on JDBC connection or something else?
...ANSWER
Answered 2021-Sep-23 at 07:18The approach of migrating first to CSV and then to Cloud SQL for MySQL sounds good. As you said, you will need to create a Cloud Storage Bucket [1], upload your CSV file to the bucket, and follow the steps here [2] corresponding to MySQL.
[1] - https://cloud.google.com/storage/docs/creating-buckets
[2] - https://cloud.google.com/sql/docs/mysql/import-export/import-export-csv#import
QUESTION
I wanted to know how to complete this method to delete conversation classes from September 7th, 2021 onwards
...ANSWER
Answered 2021-Jul-28 at 06:29You could get time like so Time.new(2021, 9, 7)
QUESTION
I am trying to copy my documents from one container of my db to another container in the same db. I followed this document https://docs.microsoft.com/en-us/azure/cosmos-db/cosmosdb-migrationchoices
and tried using DMT tool. After verifying my connection string of source and target and on clicking Import, I get error as
Errors":["The collection cannot be accessed with this SDK version as it was created with newer SDK version."]}".
I simply created the target collection from the UI. I tried by both ways(inserting Partition Key and keeping it blank). What wrong am I doing?
...ANSWER
Answered 2021-Jul-14 at 07:24What wrong am I doing?
You're not doing anything wrong. It's just that the Cosmos DB SDK used by this tool is very old (Microsoft.Azure.DocumentDB version 2.4.1
) which targets an older version of the Cosmos DB REST API. Since you created your container using a newer version of the Cosmos DB REST API, you're getting this error.
If your container is pretty basic (in the sense that it does not make use of anything special like auto scaling etc.), what you can do is create the container from the Data Migration Tool UI itself. That way you will not run into compatibility issues.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install sqlbucket
You can use sqlbucket like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
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