Re: alembic_version creation fails when in different new schema (Postgres)

2017-12-06 Thread Mike Bayer
On Wed, Dec 6, 2017 at 5:34 PM, Jules Olléon wrote: > Hello, > > I have an issue with schema creation when the alembic_version table is not > in the default (public) schema on Postgres. > > We have a setup where multiple services use the same Postgres DB (to > simplify ops

Re: Weird Alembic Behavior

2017-10-30 Thread Mike Bayer
On Mon, Oct 30, 2017 at 11:23 PM, wrote: > I have 2 migration scripts. > > The first 1 (base) is this > > from models import EntityProperty > from contextlib import contextmanager > > # revision identifiers, used by Alembic. > revision = 'ecbde8fa83e3' > down_revision = None

Re: KeyError with diamond-shaped branch-merge dependency graph

2018-05-28 Thread Mike Bayer
it's likely a bug. It looks like you've done some investigation already.I don't offhand have any understanding of the issue either, I would need to build up a reproduction case and then stare at it for several hours to figure out what's happening.So first step is if you can make a bug

SQLAlchemy 1.2.0 released

2017-12-27 Thread Mike Bayer
SQLAlchemy release 1.2.0 is now available. Release 1.2.0 is the first official release in the 1.2 series, after three beta releases. The release represents the past eighteen months of new feature development since version 1.1 was released. The 1.2 series has a large mix of features and

SQLAlchemy 1.2.1 released

2018-01-15 Thread Mike Bayer
SQLAlchemy release 1.2.1 is now available. Release 1.2.1 fixes some minor issues for the newly released 1.2 series, including a few small regressions as well as some issues reported with the new "selectin" relationship and polymorphic loader features. Changelog for 1.2.1 is at:

Re: Vertica support for Alembic

2018-02-08 Thread Mike Bayer
I dont know anything about Vertica, however if there is a SQLAlchemy dialect in the wild for Vertica, they can add the Alembic migration bits on that end, which starts with a small stub implementation. For example see redshift at

Re: A migrate thinks there's always a change with an Indexed CamelCase field since 0.92 (change 421 - 4cdb25b)

2018-01-02 Thread Mike Bayer
On Tue, Jan 2, 2018 at 2:18 PM, Seaders Oloinsigh wrote: > This change is the culprit, > > https://github.com/zzzeek/alembic/commit/4cdb25bf5d70e6e8a789c75c59a2a908433674ce#diff-e9d21bbd0f4be415139b75917420ad1c > > I've a few auto-generated tables, that are one-to-one

Re: integrate with cherrypy / sqlalchemy

2018-08-01 Thread Mike Bayer
dd where it can locate your models for import. > " > > Could you point me to documentations or examples of this? I only know what a > venv is. make your application into a package, here's an overview: http://python-packaging.readthedocs.io/en/latest/ > > Thanks a lot. > > On Monday,

Re: Run some migration revisions outside of a transaction

2018-08-10 Thread Mike Bayer
On Fri, Aug 10, 2018 at 2:00 PM, Michał Bultrowicz wrote: > Hey! > > What approach would you recommend if we want to run some revisions outside > of a transaction, but then run the other ones normally? > > Let me illustrate that. Let's say we have revisions 1,2,3,4,5. The database > is currently

Re: autogenerate revision fails in a multi-db project generated with: `alembic init --template multidb alembic`

2018-08-10 Thread Mike Bayer
On Fri, Aug 10, 2018 at 6:47 AM, wrote: > Hello > > I'm trying to use alembic to generate a migration file in a multi-db > environment. I first created the project using `alembic init --template > multidb alembic` > and then hack the `env.py` script (didn't touch to `run_migration_online`) > to

Re: online vs offline produce different "python stack traces" and general question

2018-09-07 Thread Mike Bayer
you can change the nullability of a column with op.alter_column(). There's no need to create a separate constraint. On Thu, Sep 6, 2018 at 8:07 PM, HP3 wrote: > Sorry: > > nullable = False > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy-alembic"

Re: online vs offline produce different "python stack traces" and general question

2018-09-06 Thread Mike Bayer
On Thu, Sep 6, 2018 at 1:14 PM, HP3 wrote: > Hello, > > As I try alembic (for the first time), I ran into the following stack traces > when attempting to conduct a "nasty" migration. > > I call it "nasty" because the original model was based on sqlalchemy v0.9 + > python 2.7 and the new model is

not announcing minor releases on the mailing list or twitter for now

2018-03-06 Thread Mike Bayer
Hi all - Some of you may have noticed that several SQLAlchemy releases have gone out in the past few weeks without my customary email on these lists, nor without a tweet from the SQLAlchemy twitter account. The reason for this is that I have created scripts that comprehensively run through the

Re: is this a bug ?target_metadata

2018-03-26 Thread Mike Bayer
all three of your files do: from database import Base so that is just one Base object, one metadata object. they are all the same. if you wanted them separate you'd need to call upon "Base = declarative_base()" in each module individually. On Sat, Mar 24, 2018 at 1:11 PM,

Re: mssql clustered index on non-pk field

2018-03-19 Thread Mike Bayer
so process_revision_directives is a pathway here to the extent that you need to modify the autogenerate process such that a table like this is generated for you automatically. However, Alembic's normal mode of usage is that the "autogenerate" tool is only a time-saver, and is not intended to

Re: Alembic op.alter_column deletes all rows in the database table in error

2018-10-08 Thread Mike Bayer
Hi there - I have no idea what you are seeing.an actual ALTER COLUMN operation does not delete rows. Of course, if you are using SQLite and batch mode, that might affect things, but you have not specified this. Please specify complete information including log output, stack traces,

Re: Alembic op.alter_column deletes all rows in the database table in error

2018-10-08 Thread Mike Bayer
rativeBase): > __tablename__ = 'daily_smart_meter_readings' > id = Column(Integer, primary_key=True) > customer_pk = Column( > Integer, ForeignKey('customers.id'), nullable=False, index=True > ) > reading = Column(Float, nullable=False) > reading_at = Column

Re: Support for "redo"

2018-11-14 Thread Mike Bayer
On Wed, Nov 14, 2018 at 6:07 AM wrote: > > Hi all! > > Is there support in Alembic for anything like the "redo" feature present in > Ruby on Rails' Active Record Migrations tool? I often find myself running an > "upgrade", followed by a "downgrade" and then finally another upgrade, in > order

Re: File logger fails when used with a Gunicorn/Pyramid .ini file.

2018-09-24 Thread Mike Bayer
On Sun, Sep 23, 2018 at 9:53 PM wrote: > > Hello, > > In my project.ini file I have configured logging to use a file logger as > follows: > > [loggers] > keys = root, …, alembic > > [handlers] > keys = console, file > > [formatters] > keys = generic > > [logger_root] > level = INFO > handlers =

Re: File logger fails when used with a Gunicorn/Pyramid .ini file.

2018-09-26 Thread Mike Bayer
en/latest/tutorial.html#the-migration-environment . This should likely also be a feature so https://bitbucket.org/zzzeek/alembic/issues/509/add-support-for-the-here-s-token-when has been added. > > On Wednesday, September 26, 2018 at 10:06:31 AM UTC+10, Mike Bayer wrote: >> &

Re: Migrating PEP-435 Enums

2018-09-24 Thread Mike Bayer
gt; > On Monday, September 24, 2018 at 2:36:52 PM UTC-4, Mike Bayer wrote: >> >> Postgresql ENUMs are entirely different from any other database so it >> matters a lot. For PG, you'd want to be doing op.execute("ALTER TYPE >> myenum ..."), full syntax is at >&

Re: What would be the proper way to implement a post migration hook ?

2018-12-12 Thread Mike Bayer
On Wed, Dec 12, 2018 at 10:40 AM wrote: > > Dear Alembic User Community, > > I am looking for suggestion for the best way to address the following problem: > > We have a use case where we'd like to make sure some SQL queries are always > executed after any set migration. > Our particular use

Re: many to many relation with foreign key to composite primary key

2018-12-12 Thread Mike Bayer
On Wed, Dec 12, 2018 at 1:01 PM patrick payet wrote: > > I had a SQLAlchemy model like - > > class User(DeclarativeBase): > __tablename__ = 'users' > > id = Column(BigInteger, primary_key=True) > email = Column(String(100), unique=True, nullable=False) > name =

Re: many to many relation with foreign key to composite primary key

2018-12-13 Thread Mike Bayer
here is no unique constraint matching given keys for referenced table "users_roles"). > I will send you the CREATE TABLE statements by email in a moment. yup > Best regards, > Patrick > > Le mer. 12 déc. 2018 à 19:40, Mike Bayer a écrit : >> >> On Wed,

Re: Multi-tenant and alembic question(s)

2018-12-23 Thread Mike Bayer
On Sun, Dec 23, 2018 at 7:40 AM Nikola Radovanovic wrote: > > Hi, > First of all, thank you for these great tools making my developer's life so > much easier and pleasant. > > I need suggestion/help on how to utilize multi-tenant schemes in Alembic. I > have few projects under the development

Re: many to many relation with foreign key to composite primary key

2018-12-13 Thread Mike Bayer
> FOREIGN KEY(permissions_id) REFERENCES permissions (id) >> ) >> >> CREATE TABLE users_permissions ( >> users_id BIGINT NOT NULL, >> permissions_id BIGINT NOT NULL, >> PRIMARY KEY (users_id, permissions_id), >>

Re: alembic autogenerated migrations do not see current tables

2018-11-21 Thread Mike Bayer
you need to have include_schemas=True in your env.py: https://alembic.zzzcomputing.com/en/latest/api/runtime.html?highlight=include_schemas#alembic.runtime.environment.EnvironmentContext.configure.params.include_schemas On Wed, Nov 21, 2018 at 11:49 AM Riccardo Magliocchetti wrote: > > Hello,

Re: Can I ignore it when the result of the generation is empty?

2019-01-11 Thread Mike Bayer
one thing to note with "empty" migrations is that autogenerate does not pick up things like changes of server default or datatypes unless you set some flags to turn it on,

Re: Error while running “superset db upgrade” after changing metadata DB to vertica

2019-03-04 Thread Mike Bayer
Hi there - I'm not familiar with "Superset", nor does Alembic have built in support for the "Vertica" database.It looks like the Vertica SQLAlchemy drive doesn't have Alembic support implemented which at the very least would be a small stub DefaultImpl subclass.. You would need to consult

Re: UserDefinedType CREATE INDEX hook

2019-01-24 Thread Mike Bayer
On Thu, Jan 24, 2019 at 4:17 AM Nikola Radovanovic wrote: > > Hi all, > I have a need to use PostGIS extension in order to get support for objects > like Point and Polygon provided by geoalchemy2 in PostgreSql. > > Now, the issue I encounter is that while migrating model which uses >

Re: merging old versions

2019-06-20 Thread Mike Bayer
On Thu, Jun 20, 2019, at 1:45 PM, Michael Merickel wrote: > I think the basic idea is to create a database and codebase in the state of > the target revision. Then autogenerate a migration from nothing to that > revision - just like you would do when starting to use alembic from an > existing

Re: How to handle `default` column values before/after commit()

2019-05-06 Thread Mike Bayer
On Mon, May 6, 2019 at 12:06 AM wrote: > > Suppose the following code: > > # We define a base for all DB objects, currently empty. > class _Base: > pass > > Base = declarative_base(cls=_Base, metadata=MetaData(naming_convention=…)) > > # Then the objects. > class User(Base): >

Re: Python 3.7 - RuntimeError: generator raised StopIteration

2019-06-28 Thread Mike Bayer
On Fri, Jun 28, 2019, at 4:01 PM, gbr wrote: > I've upgraded my application to Python 3.7 and to the latest version of > Alembic which triggers an exception when `context.get_current_revision()` is > called. > > ``` > File "app.py", line 395, in check_database_version > current_rev =

Re: Alembic: Varying database names per environment?

2019-08-18 Thread Mike Bayer
On Sun, Aug 18, 2019, at 6:50 PM, Scott wrote: > Looking to use Alembic to manage migrations. > > We currently have different database names in each environment, so for dev, > test and prod we have db_dev, db_test and db_prod respectively. > > Is this database naming scheme going to be

Re: Alembic: Varying database names per environment?

2019-08-19 Thread Mike Bayer
On Mon, Aug 19, 2019, at 7:24 AM, Scott wrote: > On Monday, August 19, 2019 at 9:58:19 AM UTC+10, Mike Bayer wrote: >> >> >> On Sun, Aug 18, 2019, at 6:50 PM, Scott wrote: >>> Looking to use Alembic to manage migrations. >>> >>> We currently h

Re: How to rename column on MySQL without deleting existing data?

2019-08-27 Thread Mike Bayer
On Tue, Aug 27, 2019, at 6:15 AM, Mike wrote: > *Setup:* > mysql> SELECT version(); > > * 5.7.27-0ubuntu0.18.04.1 > * Python 3.6.8 > * SQLAlchemy 1.3.6 > * Alembic 1.0.11 > > > *models.py:* > class Experiments(db.Model): > id = db.Column(db.Integer, primary_key=True) > # country =

Re: Paritioned Table Migration

2019-08-29 Thread Mike Bayer
On Thu, Aug 29, 2019, at 8:55 AM, Stephan Gerhard wrote: > Hi, > > I am wondering whether it is possible to use Alembic to define a migration > where I add a partitioned table - a feature that is supported in Postgres 12 > - e.g. using range partitions. >

Re: extending enum type natively in postgres using alembic

2019-10-31 Thread Mike Bayer
On Thu, Oct 31, 2019, at 8:45 AM, Alexander wrote: > Dear colleagues, > > I would like to extend enum type in postgres using alembic and currently i > have to do the following: > > name = 'my_type' > old_enum = sa.dialects.postgresql.ENUM('value1', 'value2', name=name) > new_enum =

Re: Automating charset encoding/collation conversion for MySQL db.

2019-12-04 Thread Mike Bayer
On Tue, Dec 3, 2019, at 7:50 PM, Jens Troeger wrote: > Hello, > > Using a MySQL database keeping Unicode strings under control turned out to be > a bit of a challenge. I could have sworn that character encoding and > collation

Re: Snowflake odities and ReplaceableObject

2019-10-11 Thread Mike Bayer
I think it would be simplest to use a regular expression to pull out the symbol names from the declared function in order to write out the DROP text. Otherwise, just add additional arguments to ReplaceableObject. It's a recipe so you should change it directly, I wouldn't create new superclasses

Re: Alembic: Change the order of the columns for a table

2020-03-04 Thread Mike Bayer
t would probably work to set col.unique=False, col.index=False before applying the Column to the new operation so that these don't double up for the constraints that we are already getting from the table. let me know if that works and we can update the demo. > > Thanks again for your

Re: Alembic: Change the order of the columns for a table

2020-03-03 Thread Mike Bayer
On Tue, Mar 3, 2020, at 3:36 AM, David Siller wrote: > Hello, > > first and foremost: thank you for SQLAlchemy and Alembic. I've worked with a > lot of ORMs, but only with these two I feel very comfortable and I'm doing a > lot of crazy stuff with it. > > The current problem that I have: I'm

Re: Re: Re: Re: Integrate PyHive and Alembic

2020-02-27 Thread Mike Bayer
On Thu, Feb 27, 2020, at 2:49 PM, Ke Zhu - k...@us.ibm.com wrote: > On Wed, 2020-02-26 at 11:07 -0500, Mike Bayer wrote: >> oh, that issue is talking about rowcount. Alembic does not need rowcount to >> function correctly. I see that Alembic is doing this now, however there i

Re: Invoke commands with custom env.py from library

2020-03-05 Thread Mike Bayer
ere is truly something blocking ScriptDirectory from working this way, maybe I'd suggest monkeypatching, but script_directory and version_locations look separate to me and are handled separately all the way from ScriptDirectory.from_config(). > > On Thursday, March 5, 2020 at 12:21:

Re: Invoke commands with custom env.py from library

2020-03-05 Thread Mike Bayer
On Thu, Mar 5, 2020, at 8:08 AM, Daniel Cardin wrote: > I am attempting to write a library which invokes alembic commands, while > referencing the migrations of a separate package which has installed said > library. > > The intent here, is for the library to invoke the alembic commands with

Re: Re: Integrate PyHive and Alembic

2020-02-24 Thread Mike Bayer
B itself. I don't know anything about Hive/Presto, but they *are* databases so I'd assume you can put data in them. > > On Sat, 2020-01-25 at 18:19 -0500, Mike Bayer wrote: >> >> >> On Fri, Jan 24, 2020, at 1:56 PM, Ke Zhu wrote: >>> Just discovered this po

Re: How to enable verbosity on “alembic upgrade head”?

2020-02-27 Thread Mike Bayer
SQL logging will render all the SQL being emitted which should be enough to see everything the script is doing against the database. that is, if you ran op.alter_column(), you'd see "ALTER COLUMN..." in the log. not sure what else you are looking to see. do you think you're having a deadlock

Re: Re: Re: Integrate PyHive and Alembic

2020-02-26 Thread Mike Bayer
embic side. > > While, the answer will be no to PrestoSQL which is just a SQL query engine > that delegates data model and data store to query targets > (MySQL/Postgres/Kafka/Elasticsearch etc) via connectors. > > On Mon, 2020-02-24 at 18:28 -0500, Mike Bayer wrote: >

Re: Integrate PyHive and Alembic

2020-01-25 Thread Mike Bayer
t;https://stackoverflow.com/questions/59887588/how-to-add-new-dialect-to-alembic-besides-built-in-dialects> > in stackoverflow but raised this group is a better place to get help. > > > On Friday, February 10, 2017 at 9:45:38 AM UTC-5, mike bayer wrote: >> >> >> On

Re: Using enums with schema_translate_map

2020-02-17 Thread Mike Bayer
mm nope we have plenty of tests for this here: https://github.com/sqlalchemy/sqlalchemy/blob/master/test/dialect/postgresql/test_compiler.py#L223 On Mon, Feb 17, 2020, at 2:49 PM, Mike Bayer wrote: > it's possible also that PG Enum CREATE TYPE doesn't work with > schema_translate_map,

Re: Using enums with schema_translate_map

2020-02-17 Thread Mike Bayer
/sqlalchemy/sqlalchemy/issues/5158 will be fixed in 1.3.14 On Mon, Feb 17, 2020, at 2:51 PM, Mike Bayer wrote: > mm nope we have plenty of tests for this here: > > https://github.com/sqlalchemy/sqlalchemy/blob/master/test/dialect/postgresql/test_compiler.py#L223 > > > > On Mon, Feb

Re: Using enums with schema_translate_map

2020-02-17 Thread Mike Bayer
schema_translate_map is not yet supported with all Alembic ops: https://github.com/sqlalchemy/alembic/issues/555 you will need to fill in the "schema" parameter explicitly when you call upon op.create_table() On Mon, Feb 17, 2020, at 12:47 PM, Brian Hill wrote: > I'm having trouble using

Re: Using enums with schema_translate_map

2020-02-17 Thread Mike Bayer
it's possible also that PG Enum CREATE TYPE doesn't work with schema_translate_map, would need to evaluate that on the SQLAlchemy side. On Mon, Feb 17, 2020, at 2:45 PM, Mike Bayer wrote: > schema_translate_map is not yet supported with all Alembic ops: > > https://github.com/sqlalchem

Re: Migrate alembic_version table from Public to tenant schema

2020-02-18 Thread Mike Bayer
On Tue, Feb 18, 2020, at 1:17 PM, Brian Hill wrote: > Is there a way to move the alembic_version table in the Public schema > (postgres) to a specific schema (mult-tenant) as part of a migration? I highly doubt this is possible in the general case without the raw SQL in your env.py, because

Re: Invoke commands with custom env.py from library

2020-03-05 Thread Mike Bayer
ommand is targeting the project "foo"'s local > migrations/versions folder > > The specifics of the above are just based on my knowledge of alembic, so if > there's another process i could be doing where env.py isn't "invoked" so much > as the above code block is ju

Re: 'alembic current' crashes with stack trace

2020-03-26 Thread Mike Bayer
Somewhere in your model, likely inside of a Table() object, there is a keyword "index" being used which is invalid. Look for that keyword and remove it. On Thu, Mar 26, 2020, at 1:53 PM, Rob Schottland wrote: > Suddenly, I can't get alembic (1.3.3?). alembic history does work, but my > most

Re: Autogenerate with Multi-Tenant

2020-03-19 Thread Mike Bayer
On Thu, Mar 19, 2020, at 5:30 PM, Brian Hill wrote: > Are there known issues with using autogenerate with multi-tenant > (schema_translate_map)? it's complicated and not one-size-fits-all, if you consider that to be an issue > > My metadata doesn't have a schema and I my >

Re: Autogenerate with Multi-Tenant

2020-03-20 Thread Mike Bayer
Thursday, March 19, 2020 at 8:20:06 PM UTC-4, Mike Bayer wrote: >> >> >> On Thu, Mar 19, 2020, at 7:41 PM, Brian Hill wrote: >>> >>> >>> On Thursday, March 19, 2020 at 7:19:08 PM UTC-4, Mike Bayer wrote: >>>> so let me get this straight: &

Re: Autogenerate with Multi-Tenant

2020-03-19 Thread Mike Bayer
h. you might need to disable the schema translate map when autogenerate runs but try it without doing that first. On Thu, Mar 19, 2020, at 7:09 PM, Brian Hill wrote: > Here's my env.py. Thanks for the help. > Brian > > On Thursday, March 19, 2020 at 5:37:38 PM UTC-4, Mike Bayer wrote

Re: Autogenerate with Multi-Tenant

2020-03-19 Thread Mike Bayer
On Thu, Mar 19, 2020, at 7:41 PM, Brian Hill wrote: > > > On Thursday, March 19, 2020 at 7:19:08 PM UTC-4, Mike Bayer wrote: >> so let me get this straight: >> >> 1. you have many schemas >> > > yes > >> >> 2. you want to run

Re: Autogenerate with Multi-Tenant

2020-03-20 Thread Mike Bayer
> it works when my schema is 'public', when it matches metadata. my solution > will be to set my schema to 'public' and use this simple env.py. > > thanks, > > brian > > On Friday, March 20, 2020 at 9:49:52 AM UTC-4, Mike Bayer wrote: >> I just realized that you reall

Re: KeyError: 'sqlnotapplicable' when running alembic revision --autogenerate

2020-09-04 Thread Mike Bayer
this warning is the culprit: SAWarning: index key 'sqlnotapplicable' was not located in columns for table ‘github_active_users' I believe you should report this to the ibm_db_sa folks. https://github.com/ibmdb/python-ibmdbsa/issues you would need to share the "CREATE TABLE" statements

Re: command.init api ignores the cfg settings

2020-10-09 Thread Mike Bayer
hi there - this question lacks specifics. There are no configuration options that are relevant to the "alembic init" command in any case so it's not clear what config settings you are seeing as "ignored"; init uses only the name of the ini file given and this works: from alembic.config

Re: Delay between consecutive SQL statements when using Alembic on Jenkins

2020-08-17 Thread Mike Bayer
On Sun, Aug 16, 2020, at 11:10 PM, Michał Guzek wrote: > I have a problem with delays between consecutive SQL statements when Alembic > executes a migration script's upgrade() function on Jenkins: > def upgrade(): > op.execute("DELETE FROM employee WHERE name='John';") #John also has its >

Re: Stray changes detected only sometimes with revision --autogenerate

2020-09-29 Thread Mike Bayer
On Tue, Sep 29, 2020, at 3:35 PM, Mike Bayer wrote: > > > On Tue, Sep 29, 2020, at 9:17 AM, Daniel Krebs wrote: >> Hi, >> >> we're having rather strange problems with Alembic 1.4.2 and Postgres 12, >> detecting stray changes *sometimes* but also sometim

Re: Stray changes detected only sometimes with revision --autogenerate

2020-09-29 Thread Mike Bayer
On Tue, Sep 29, 2020, at 9:17 AM, Daniel Krebs wrote: > Hi, > > we're having rather strange problems with Alembic 1.4.2 and Postgres 12, > detecting stray changes *sometimes* but also sometimes not. I already dug > through the code but I increasingly get the feel that this is rooted >

Re: Stray changes detected only sometimes with revision --autogenerate

2020-09-29 Thread Mike Bayer
Hi, so I added a quick recipe to the site just now just so that the "set search path" idea is documented to some extent, that is at https://alembic.sqlalchemy.org/en/latest/cookbook.html#rudimental-schema-level-multi-tenancy-for-postgresql-databases . Re: autogenerate, if you have many

Re: Use events with expression api

2020-09-30 Thread Mike Bayer
SQL expressions are intercepted by the SQL Execution events described at https://docs.sqlalchemy.org/en/13/core/events.html#sql-execution-and-connection-events and the main ones are before_execute() and before_cursor_execute(), but it depends on what you want to do.if you want to change how

Re: Example of inline autogenerated use?

2020-11-05 Thread Mike Bayer
Not quite given in an example, I guess I could add as a recipe but then people will be using it which as you've noted isn't reliable in the general sense, let's put together how to get the MigrationScript, which it looks like you have, with then how to make the Operations object

Re: ask for help on best practices when changing table name from uppercase to lowercase

2021-01-05 Thread Mike Bayer
On Tue, Jan 5, 2021, at 9:50 AM, kz...@us.ibm.com wrote: > Thanks mike! > > I understand that it should work when querying over SQLAlchemy API. the > missing part of my use case I forgot to provide is, it only uses > Alembic/SQLAlchemy to manage schema changes, while the actual query may

Re: ask for help on best practices when changing table name from uppercase to lowercase

2021-01-04 Thread Mike Bayer
This is the casing convention of the database and SQLAlchemy does not consider the name to be in "uppercase" or "lowercase" (or even "mixed case") but rather "case insensitive", which really means the name is referred towards without any quoting.When no quoting is applied, there is

Re: branch merge schema conflict

2021-03-09 Thread Mike Bayer
just so you know, surgical-precision downgrades will be more reliable once we get the 1.6 series of Alembic out, where we have a total rewrite of how the internal traversal works in order to make upgrade/downgrades across complex trees more reliable. downgrades are not *too* common in

Re: branch merge schema conflict

2021-03-09 Thread Mike Bayer
On Tue, Mar 9, 2021, at 5:06 PM, 'br...@derocher.org' via sqlalchemy-alembic wrote: > I'm wondering how to solve an issue. > > One developer created migration 1efb > > upgrade: > drop view v1 -- moved to query in the code > > downgrade: >create view v1 as select 1 > > Another

Re: Managing multiple tenant "namespaces"

2021-04-16 Thread Mike Bayer
On Fri, Apr 16, 2021, at 7:15 AM, Nikola Radovanovic wrote: > Hi, > we have one Postgres DB with multiple schemes: > 1. general (one schema, contains users and some common and data shared > between clients/clusters) > 2. client schemes: c_client_1, c_client_2, c_client_3, etc. (all clients >

Re: Managing multiple tenant "namespaces"

2021-04-09 Thread Mike Bayer
On Wed, Apr 7, 2021, at 5:18 AM, Nikola Radovanovic wrote: > Hi, > I have a bit unusual use-case in software I work on. > > There are three main "namespaces" (kinds of data): first one is "general" > (not multi-tenant), where we keep some common security and settings data. > > Second one is

Re: alembic upgrade heads

2021-08-25 Thread Mike Bayer
seems like you should ensure that Alembic is installed in the current Python environment. looks like it is not installed correctly. On Wed, Aug 25, 2021, at 2:23 PM, Vinod Rao wrote: > Hi all: > > I have been struggling to solve the following error: > > File "/virtual_env/bin/alembic",

Re: [Renaming Alembic Table]

2022-04-11 Thread Mike Bayer
On Mon, Apr 11, 2022, at 12:47 AM, arvind aithal wrote: > Is it possible to rename the alembic table name to customised one? > > Once we run the migrations it creates *alembic_version table* which stores > the version. > > After init, when we run command migrate, by default it generates >

Re: Import data to alembic migrations

2022-05-10 Thread Mike Bayer
yes, one particular approach to this issue is discussed here: https://alembic.sqlalchemy.org/en/latest/front.html#installation start with that if nothing else is working (There are many ways to do this). On Tue, May 10, 2022, at 5:34 AM, Ilya Demidov wrote: > Hi! > > I have some problem. I

<    1   2