Is there an easy way to move a file to a different folder in dbt Cloud? - dbt

Is there an easy way to move a file to a different folder in dbt Cloud, without having to create a new file of the same name in the new folder, copy/paste from the old file, and delete the old file, which is a pain.
Is there a good reason I should NOT do this? I assume my refs still work as long as the filename remains the same, and I don't have any specific folder logic tied to this file.
For example, say I have my_model.sql in my 'staging' folder and I want to simply move it to my 'mart' folder instead. In this example I'd like to do this to reflect that my file is really a more 'stable' mart-type table file vs a staging view. I realize I can just change the materialization type, but I'm doing this more to organize things clearly. Thanks!

The way to move a file in the cloud IDE for dbt is not 100% obvious. You can use the rename function to move a file to another location.
Click on the drop down next to the file name, then select "Rename." That will open a file path and you can change where the file lives from there by typing in the new folder's name.

The easiest way I have found to do this is...not using DBT Cloud, but using github desktop (no command line needed).
Create a new branch
Open repository in github
View files in your file explorer
Move files or directory locally
Upload to github
Push to origin for the branch you created
Open a pull request
Merge
Depending on what the file or directory is you may find the creating a new branch and opening PR to be overkill. For my specific project there is a lot of legacy organization and models that we aren't totally sure don't have downstream dependencies, so creating a new branch for this allowed me to test run all of our models.
Hope this helps!

Related

How to unzip the same zip file multiple times?

I am developing a zip extractor app for which if i unzip multiple times the same zip file it should extract like myfile-1, myfile-2, myfile-3 something like this .
example : there is sampleproject.zip in my desktop when i unzip it should be like sampleproject, sampleproject-1, sampleproject-2.
Any Suggestions.
Thanks in Advance!
Based on your comment I suggest you unzip your file to a temporary directory and then move its contents into the actual directory, handling any name clashes as you do that. In outline:
Use URLForDirectory:inDomain:appropriateForURL:create:error: to create a temporary directory suitable to unzip into. You should pass your the URL of your destinationPath for the appropriateForURL: parameter; this should give you a temporary directory on the same volume as destinationPath making placing the unzipped items into the right place moves rather than copies.
Unzip into the temporary directory returned by (1)
Now use NSFileManager calls to traverse the temporary directory moving each item found to destinationPath, renaming as needed to avoid name clashes.
Remove the temporary directory.
If you have problems implementing this algorithm ask a new question, show your code, explain your problem, and include a link back to this question so the thread can be followed. Someone will then undoubtedly help you with the next step.
HTH

Can openrdf-sesame recover the unseen data in openrdf-workbench?

Somehow I found some of the repositories(physics_base for example) in workbench are missing, but when I searched into the data path /.aduna/openrdf-sesame/repositories/physics_base, I found the data still exist.
So does this mean that there is a way to recover my data in workbench?
Thank you for any suggestion.
Yes that's possible. Just create a new repository of the same type in the workbench, open it once, shut down sesame, then copy over the contents of the directory to the data directory of your new repository.
It might even be possible to just create a repository of the same name and have it automatically pick up the existing data, but I can't test that right now (in a pub), so if you want to try that, make a backup first.

Writing to a document's enclosing folder

When you open an XCode project it can automatically write to the enclosing folder of the respective .xcodeproj file.
In a sandboxed application you can only write to files that are opened, or write to directories that have been opened with NSOpenPanel.
What I'm trying to achieve is the same functionality as XCode ; my app makes a project file (a document much like an .xcodeproj file) that is saved to a user-selected directory, and within that directory other files are created relating to that project file. However, if the file is re-opened after terminating the app, I end up losing permission to write to the enclosing directory.
I see bookmarks are an option but they do not provide the same functionality. If the project file is moved to a new directory it makes no sense to keep writing to the old directory, and I'd have to ask the user for permission to write to the new directory. I don't find this user-friendly. Is there absolutely no way to resolve this problem?
If the project file is moved to a new directory it makes no sense to keep writing to the old directory, and I'd have to ask the user for permission to write to the new directory. I don't find this user-friendly. Is there absolutely no way to resolve this problem?
Unfortunately for you this is Apple's sandbox model and you need to adapt to it. The process you describe is a good way to handle your situation - when you first create a project file ask the user to select the folder to store it and save a bookmark to that folder, when an existing project file is opened check whether you have a saved bookmark for its parent folder and if not put up a dialog explaining the file has been moved and ask the user for permission to use the new parent folder and keep a bookmark to it.
Users are used to these dialogs from apps, the sandbox has been around a long time. You might find keeping a number of saved bookmarks and optimising your collection will improve your users experience. E.g. remember that a bookmark to a folder grants access to all the files and folders within it, and the files/folders within those folders, etc. This means if a user reorganises by moving projects into sub folders may not require you to ask for a new bookmark, and similarly when a new bookmark is acquired any existing ones you have stored to folders contained by the new bookmark's folder are redundant and can be removed from your collection of stored bookmarks.
Not the answer you really wanted, but hope it helps!

Moving subproject files and updating links in master project

I am working in MS Project and frequently move schedules from a share drive to my computer, manipulate and run macros on them, then copy them back up to the share drive.
Generally if I copy all of the subprojects with the Master project at one time the links to the subprojects will update to the destination folder (the one on my computer.) Occasionally I do this and the links do not update, so the Master Schedule is still pointing to the files on the share drive. This causes problems with the macro I then run on it. I have not been able to find anything in forums about this problem.
Has anyone come across this problem? Is there a setting somewhere that is getting changed? Any help would be appreciated.
Yes, I've come across this problem.
The most reliable way of copying a master schedule and all it's sub projects without creating the duplicate links is to:
Select all the files on the share drive
Right click and send them to a zip file
Move this zip file to your local drive
Right click on the zip file and extract all
Then do the same in reverse once you've run your macros. This should reliably copy the master/sub project files with the correct links, without creating the erroneous links you've seen.

WiX: Rename a folder during installation

I have very complex folders structure to install (dozens of folders/subfolders).
I have prepared the whole structure with heat.exe, but some folder names have "template" names instead of the real ones.
Is it possible using WiX to rename the "templated" folders during the installation?
Say I have
DirA
DirTemplate1
DirC
DirD
DirTemplate2
DirE
I can get real names for DirTemplate1 and DirTemplate2 via UI only.
Can I rename the folders after they are copied to the target?
I suppose that you familiar with WiX. And explain a few variants how it could be done.
In directory table you named needed folders with CAPITAL letters, for example DIRTEMPLATE1. Then create dialog window and set this Directory with new value. During installation directory will be created with new folder name.
(Not recommended) Create custom action which will rename needed directories at the end of installation. Not recommended because uninstallation won't delete new folders, the Repair won't work as should.
I realized that this is simply not possible to do in a right way, it contradicts the installation ideology. I would accept such answer and start thinking on a different solution. Not all problems have a solution.